mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: test utils (#16588)
This commit is contained in:
parent
1423cfd53c
commit
63c01b78e2
8 changed files with 245 additions and 216 deletions
|
|
@ -21,12 +21,12 @@ describe(VersionService.name, () => {
|
|||
it('record the current version on startup', async () => {
|
||||
const { context, sut } = await setup();
|
||||
|
||||
const itemsBefore = await context.versionHistoryRepository.getAll();
|
||||
const itemsBefore = await context.versionHistory.getAll();
|
||||
expect(itemsBefore).toHaveLength(0);
|
||||
|
||||
await sut.onBootstrap();
|
||||
|
||||
const itemsAfter = await context.versionHistoryRepository.getAll();
|
||||
const itemsAfter = await context.versionHistory.getAll();
|
||||
expect(itemsAfter).toHaveLength(1);
|
||||
expect(itemsAfter[0]).toEqual({
|
||||
createdAt: expect.any(Date),
|
||||
|
|
@ -38,7 +38,7 @@ describe(VersionService.name, () => {
|
|||
it('should queue memory creation when upgrading from 1.128.0', async () => {
|
||||
const { context, jobMock, sut } = await setup();
|
||||
|
||||
await context.versionHistoryRepository.create({ version: 'v1.128.0' });
|
||||
await context.versionHistory.create({ version: 'v1.128.0' });
|
||||
await sut.onBootstrap();
|
||||
|
||||
expect(jobMock.queue).toHaveBeenCalledWith({ name: JobName.MEMORIES_CREATE });
|
||||
|
|
@ -47,7 +47,7 @@ describe(VersionService.name, () => {
|
|||
it('should not queue memory creation when upgrading from 1.129.0', async () => {
|
||||
const { context, jobMock, sut } = await setup();
|
||||
|
||||
await context.versionHistoryRepository.create({ version: 'v1.129.0' });
|
||||
await context.versionHistory.create({ version: 'v1.129.0' });
|
||||
await sut.onBootstrap();
|
||||
|
||||
expect(jobMock.queue).not.toHaveBeenCalled();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue