test: unify i18next mocks into centralized helpers (#30376)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou
2025-12-31 15:53:33 +08:00
committed by GitHub
parent cad7101534
commit 2bb1e24fb4
21 changed files with 178 additions and 293 deletions

View File

@ -78,17 +78,6 @@ function createMockLogData(logs: TriggerLogEntity[] = []): { logs: TriggerLogEnt
// Mock Setup
// ============================================================================
const mockTranslate = vi.fn((key: string, options?: { ns?: string }) => {
// Build full key with namespace prefix if provided
const fullKey = options?.ns ? `${options.ns}.${key}` : key
return fullKey
})
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: mockTranslate,
}),
}))
// Mock plugin store
const mockPluginDetail = createMockPluginDetail()
const mockUsePluginStore = vi.fn(() => mockPluginDetail)

View File

@ -68,17 +68,6 @@ function createMockSubscriptionBuilder(overrides: Partial<TriggerSubscriptionBui
// Mock Setup
// ============================================================================
const mockTranslate = vi.fn((key: string, options?: { ns?: string }) => {
// Build full key with namespace prefix if provided
const fullKey = options?.ns ? `${options.ns}.${key}` : key
return fullKey
})
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: mockTranslate,
}),
}))
// Mock plugin store
const mockPluginDetail = createMockPluginDetail()
const mockUsePluginStore = vi.fn(() => mockPluginDetail)

View File

@ -12,16 +12,6 @@ import { OAuthEditModal } from './oauth-edit-modal'
// ==================== Mock Setup ====================
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string, options?: { ns?: string }) => {
// Build full key with namespace prefix if provided
const fullKey = options?.ns ? `${options.ns}.${key}` : key
return fullKey
},
}),
}))
const mockToastNotify = vi.fn()
vi.mock('@/app/components/base/toast', () => ({
default: { notify: (params: unknown) => mockToastNotify(params) },