From 5bb6be5cacba7e7920711498ee4b5702e9c35f46 Mon Sep 17 00:00:00 2001 From: dependentmadani Date: Tue, 24 Sep 2024 18:46:10 +0100 Subject: [PATCH] update (note parents): fix the issue of tests, working good --- src/domain/service/note.ts | 7 ++++--- src/presentation/http/router/note.test.ts | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/domain/service/note.ts b/src/domain/service/note.ts index e9531889..c6eddb47 100644 --- a/src/domain/service/note.ts +++ b/src/domain/service/note.ts @@ -452,11 +452,12 @@ export default class NoteService { public async getNoteParents(noteId: NoteInternalId): Promise { 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, }; }); diff --git a/src/presentation/http/router/note.test.ts b/src/presentation/http/router/note.test.ts index 840180ab..9842a7b5 100644 --- a/src/presentation/http/router/note.test.ts +++ b/src/presentation/http/router/note.test.ts @@ -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(); @@ -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,