mirror of https://github.com/langgenius/dify.git
test: enhance translation function in plugin detail panel tests to support namespace handling
This commit is contained in:
parent
23a8bebb62
commit
1d2eac1b4e
|
|
@ -78,7 +78,11 @@ function createMockLogData(logs: TriggerLogEntity[] = []): { logs: TriggerLogEnt
|
|||
// Mock Setup
|
||||
// ============================================================================
|
||||
|
||||
const mockTranslate = vi.fn((key: string) => key)
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,11 @@ function createMockSubscriptionBuilder(overrides: Partial<TriggerSubscriptionBui
|
|||
// Mock Setup
|
||||
// ============================================================================
|
||||
|
||||
const mockTranslate = vi.fn((key: string) => key)
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,13 @@ import { OAuthEditModal } from './oauth-edit-modal'
|
|||
// ==================== Mock Setup ====================
|
||||
|
||||
vi.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({ t: (key: string) => key }),
|
||||
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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue