diff --git a/backend/src/history/history.service.spec.ts b/backend/src/history/history.service.spec.ts index 9988de0b6..ff67f580b 100644 --- a/backend/src/history/history.service.spec.ts +++ b/backend/src/history/history.service.spec.ts @@ -393,15 +393,18 @@ describe('HistoryService', () => { updatedAt: historyEntryImport.lastVisitedAt, }; - const createQueryBuilder = mockSelectQueryBuilderInRepo(noteRepo, note); + mockSelectQueryBuilderInRepo(noteRepo, note); + const createQueryBuilderForEntityManager = { + where: () => createQueryBuilderForEntityManager, + getMany: () => [historyEntry], + }; + const mockedManager = Mock.of({ - find: jest.fn().mockResolvedValueOnce([historyEntry]), - createQueryBuilder: () => createQueryBuilder, - remove: jest.fn().mockImplementationOnce(async (_: HistoryEntry) => { - // TODO: reimplement checks below - //expect(await (await entry.note).aliases).toHaveLength(1); - //expect((await (await entry.note).aliases)[0].name).toEqual(alias); - //expect(entry.pinStatus).toEqual(false); + createQueryBuilder: jest.fn().mockImplementation(() => createQueryBuilderForEntityManager), + remove: jest.fn().mockImplementationOnce(async (entry: HistoryEntry) => { + expect(await (await entry.note).aliases).toHaveLength(1); + expect((await (await entry.note).aliases)[0].name).toEqual(alias); + expect(entry.pinStatus).toEqual(false); }), save: jest.fn().mockImplementationOnce(async (entry: HistoryEntry) => { expect((await entry.note).aliases).toEqual(