mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
chore(web): add asset store unit tests (#8077)
chore(web): asset store unit tests
This commit is contained in:
parent
e6f2bb9f89
commit
9c6a26de9f
4 changed files with 407 additions and 9 deletions
18
web/src/lib/__mocks__/sdk.mock.ts
Normal file
18
web/src/lib/__mocks__/sdk.mock.ts
Normal 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>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue