diff --git a/src/components/dialog/content/setting/SettingItem.spec.ts b/src/components/dialog/content/setting/SettingItem.spec.ts index 7db092d85..7a7b93171 100644 --- a/src/components/dialog/content/setting/SettingItem.spec.ts +++ b/src/components/dialog/content/setting/SettingItem.spec.ts @@ -17,6 +17,16 @@ vi.mock('@/utils/formatUtil', () => ({ normalizeI18nKey: vi.fn() })) +// Mock the api module +vi.mock('@/scripts/api', () => ({ + api: { + fileURL: (path: string) => `/fileURL${path}`, + apiURL: (path: string) => `/apiURL${path}`, + addEventListener: vi.fn(), + removeEventListener: vi.fn() + } +})) + describe('SettingItem', () => { const mountComponent = (props: any, options = {}): any => { return mount(SettingItem, { diff --git a/src/components/node/NodePreview.spec.ts b/src/components/node/NodePreview.spec.ts index e8e629e75..ea2037e0d 100644 --- a/src/components/node/NodePreview.spec.ts +++ b/src/components/node/NodePreview.spec.ts @@ -10,6 +10,16 @@ import * as markdownRendererUtil from '@/utils/markdownRendererUtil' import NodePreview from './NodePreview.vue' +// Mock the api module +vi.mock('@/scripts/api', () => ({ + api: { + fileURL: (path: string) => `/fileURL${path}`, + apiURL: (path: string) => `/apiURL${path}`, + addEventListener: vi.fn(), + removeEventListener: vi.fn() + } +})) + describe('NodePreview', () => { let i18n: ReturnType let pinia: ReturnType diff --git a/src/components/sidebar/tabs/queue/ResultGallery.spec.ts b/src/components/sidebar/tabs/queue/ResultGallery.spec.ts index bf96984be..52a221cc1 100644 --- a/src/components/sidebar/tabs/queue/ResultGallery.spec.ts +++ b/src/components/sidebar/tabs/queue/ResultGallery.spec.ts @@ -9,6 +9,16 @@ import type { ResultItemImpl } from '@/stores/queueStore' import ResultGallery from './ResultGallery.vue' +// Mock the api module +vi.mock('@/scripts/api', () => ({ + api: { + fileURL: (path: string) => `/fileURL${path}`, + apiURL: (path: string) => `/apiURL${path}`, + addEventListener: vi.fn(), + removeEventListener: vi.fn() + } +})) + type MockResultItem = Partial & { filename: string subfolder: string