Skip to content

Commit

Permalink
update (note parents): fix the issue of tests, working good
Browse files Browse the repository at this point in the history
  • Loading branch information
dependentmadani committed Sep 24, 2024
1 parent 5c6cfc0 commit 5bb6be5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/domain/service/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,12 @@ export default class NoteService {
public async getNoteParents(noteId: NoteInternalId): Promise<NotePublic[]> {
const noteParents = await this.noteRepository.getNoteParents(noteId);
const noteParentsPublic: NotePublic[] = noteParents.map((note) => {
console.log('note content inside map:', note);

return {
...note,
content: note.content,
id: note.publicId,
creatorId: note.creatorId,
createdAt: note.createdAt,
updatedAt: note.updatedAt,
};
});

Expand Down
6 changes: 5 additions & 1 deletion src/presentation/http/router/note.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('Note API', () => {
};

beforeEach(async () => {
if (expect.getState().currentTestName === 'Returns note parents by note public id in different note accessibility and authorization') {
if (expect.getState().currentTestName?.includes('Returns note parents by note public id in different note accessibility and authorization') ?? false) {
/** Create test user */
context.user = await global.db.insertUser();

Expand Down Expand Up @@ -739,6 +739,10 @@ describe('Note API', () => {
expect(response?.statusCode).toBe(expectedStatusCode);
expect(response?.json()).toMatchObject({
parents: [
{
id: context.parentNote.publicId,
content: context.parentNote.content,
},
{
id: context.differentChildNote.publicId,
content: context.differentChildNote.content,
Expand Down

0 comments on commit 5bb6be5

Please sign in to comment.