mirror of
https://github.com/purocean/yn.git
synced 2026-10-16 15:41:46 +08:00
test: fix export service mocks
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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', () => ({
|
||||
|
||||
Reference in New Issue
Block a user