-
-
Notifications
You must be signed in to change notification settings - Fork 615
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
35 lines (32 loc) · 1.01 KB
/
vitest.setup.ts
File metadata and controls
35 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { beforeEach, afterEach } from 'vitest';
import { clearMocks } from '@tauri-apps/api/mocks';
import { installTauriMock } from './tests/utils/tauriMock';
import { createPinia, setActivePinia } from 'pinia';
import { InvokeArgs } from '@tauri-apps/api/core';
import { mediaHandlers } from './tests/utils/mocks/mediaHandlers';
import { MockData } from './tests/e2e/utils/mockData';
beforeEach(() => {
clearMocks();
installTauriMock({ ...mediaHandlers });
setActivePinia(createPinia());
});
afterEach(() => {
clearMocks();
});
declare global {
interface Window {
__TAURI_INTERNALS__: {
invoke: (cmd: string, args?: InvokeArgs) => Promise<unknown>;
transformCallback: <T extends (...args: unknown[]) => unknown>(
cb: T,
once?: boolean,
) => T;
unregisterCallback: (...args: unknown[]) => void;
plugins: Record<string, unknown>;
};
__TAURI_EVENT_PLUGIN_INTERNALS__: {
unregisterListener: (event: string, id: number) => void;
};
E2E: MockData;
}
}