chore(web): add asset store unit tests (#8077)

chore(web): asset store unit tests
This commit is contained in:
Michel Heusschen 2024-03-20 05:41:31 +01:00 committed by GitHub
parent e6f2bb9f89
commit 9c6a26de9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 407 additions and 9 deletions

View file

@ -0,0 +1,18 @@
import sdk from '@immich/sdk';
import type { Mock, MockedObject } from 'vitest';
vi.mock('@immich/sdk', async (originalImport) => {
const module = await originalImport<typeof import('@immich/sdk')>();
const mocks: Record<string, Mock> = {};
for (const [key, value] of Object.entries(module)) {
if (typeof value === 'function') {
mocks[key] = vi.fn();
}
}
const mock = { ...module, ...mocks };
return { ...mock, default: mock };
});
export const sdkMock = sdk as MockedObject<typeof sdk>;