test: fix export service mocks

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
purocean
2026-09-13 22:05:10 +08:00
co-authored by Copilot App
parent a7a3ffa549
commit fbc958cc06
+15 -1
View File
@@ -23,6 +23,8 @@ vi.mock('lodash-es', async importOriginal => ({
}))
vi.mock('@fe/core/hook', () => ({
registerHook: vi.fn(),
removeHook: vi.fn(),
triggerHook: mocks.triggerHook,
}))
@@ -32,6 +34,7 @@ vi.mock('@fe/support/embed', () => ({
vi.mock('@fe/support/env', () => ({
getElectronRemote: () => mocks.remote,
isMacOS: false,
get isElectron () {
return mocks.isElectron
},
@@ -42,10 +45,14 @@ vi.mock('@fe/support/env', () => ({
}))
vi.mock('@fe/support/store', () => ({
default: { state: mocks.state },
default: {
state: mocks.state,
watch: vi.fn(),
},
}))
vi.mock('@fe/utils', () => ({
getLogger: vi.fn(() => ({ debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() })),
sleep: vi.fn(() => Promise.resolve()),
}))
@@ -57,8 +64,15 @@ vi.mock('@fe/services/repo', () => ({
getRepo: mocks.getRepo,
}))
vi.mock('@fe/services/setting', () => ({
getSetting: (_key: string, defaultValue?: any) => defaultValue,
}))
vi.mock('@fe/services/i18n', () => ({
getCurrentLanguage: () => 'en-US',
$$t: (key: string) => key,
t: (key: string) => key,
useI18n: () => ({ t: (key: string) => key, $t: { value: (key: string) => key } }),
}))
vi.mock('@fe/services/view', () => ({