mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: repository mocks (#16785)
This commit is contained in:
parent
1b35400043
commit
1382b27349
59 changed files with 320 additions and 550 deletions
|
|
@ -4,6 +4,7 @@ import { serverVersion } from 'src/constants';
|
|||
import { ImmichEnvironment, JobName, JobStatus, SystemMetadataKey } from 'src/enum';
|
||||
import { VersionService } from 'src/services/version.service';
|
||||
import { mockEnvData } from 'test/repositories/config.repository.mock';
|
||||
import { factory } from 'test/small.factory';
|
||||
import { newTestService, ServiceMocks } from 'test/utils';
|
||||
|
||||
const mockRelease = (version: string) => ({
|
||||
|
|
@ -30,7 +31,12 @@ describe(VersionService.name, () => {
|
|||
|
||||
describe('onBootstrap', () => {
|
||||
it('should record a new version', async () => {
|
||||
mocks.versionHistory.getAll.mockResolvedValue([]);
|
||||
mocks.versionHistory.getLatest.mockResolvedValue(void 0);
|
||||
mocks.versionHistory.create.mockResolvedValue(factory.versionHistory());
|
||||
|
||||
await expect(sut.onBootstrap()).resolves.toBeUndefined();
|
||||
|
||||
expect(mocks.versionHistory.create).toHaveBeenCalledWith({ version: expect.any(String) });
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue