mirror of https://github.com/langgenius/dify.git
fix test
This commit is contained in:
parent
6f2663deca
commit
40cb58cbef
|
|
@ -15,11 +15,10 @@ vi.mock('react-i18next', async () => {
|
|||
...actual,
|
||||
useTranslation: () => ({
|
||||
t: (key: string, options?: Record<string, unknown>) => {
|
||||
const prefix = options?.ns ? `${options.ns}.` : ''
|
||||
if (options?.returnObjects)
|
||||
return [`${key}-feature-1`, `${key}-feature-2`]
|
||||
if (options)
|
||||
return `${key}:${JSON.stringify(options)}`
|
||||
return key
|
||||
return [`${prefix}${key}-feature-1`, `${prefix}${key}-feature-2`]
|
||||
return `${prefix}${key}`
|
||||
},
|
||||
i18n: {
|
||||
language: 'en',
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ const featuresTranslations: Record<string, string[]> = {
|
|||
vi.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, options?: Record<string, unknown>) => {
|
||||
if (options?.returnObjects)
|
||||
return featuresTranslations[key] || []
|
||||
const prefix = options?.ns ? `${options.ns}.` : ''
|
||||
if (options?.returnObjects)
|
||||
return featuresTranslations[`${prefix}${key}`] || []
|
||||
return `${prefix}${key}`
|
||||
},
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue