test: complete todo

Signed-off-by: yamashush <38120991+yamashush@users.noreply.github.com>
This commit is contained in:
yamashush 2024-01-19 12:21:27 +09:00 committed by Philip Molares
parent 662de1e9f8
commit 1c22a425bd

View file

@ -393,15 +393,18 @@ describe('HistoryService', () => {
updatedAt: historyEntryImport.lastVisitedAt, updatedAt: historyEntryImport.lastVisitedAt,
}; };
const createQueryBuilder = mockSelectQueryBuilderInRepo(noteRepo, note); mockSelectQueryBuilderInRepo(noteRepo, note);
const createQueryBuilderForEntityManager = {
where: () => createQueryBuilderForEntityManager,
getMany: () => [historyEntry],
};
const mockedManager = Mock.of<EntityManager>({ const mockedManager = Mock.of<EntityManager>({
find: jest.fn().mockResolvedValueOnce([historyEntry]), createQueryBuilder: jest.fn().mockImplementation(() => createQueryBuilderForEntityManager),
createQueryBuilder: () => createQueryBuilder, remove: jest.fn().mockImplementationOnce(async (entry: HistoryEntry) => {
remove: jest.fn().mockImplementationOnce(async (_: HistoryEntry) => { expect(await (await entry.note).aliases).toHaveLength(1);
// TODO: reimplement checks below expect((await (await entry.note).aliases)[0].name).toEqual(alias);
//expect(await (await entry.note).aliases).toHaveLength(1); expect(entry.pinStatus).toEqual(false);
//expect((await (await entry.note).aliases)[0].name).toEqual(alias);
//expect(entry.pinStatus).toEqual(false);
}), }),
save: jest.fn().mockImplementationOnce(async (entry: HistoryEntry) => { save: jest.fn().mockImplementationOnce(async (entry: HistoryEntry) => {
expect((await entry.note).aliases).toEqual( expect((await entry.note).aliases).toEqual(