From 40cb58cbefcb16aac26399ae1b86d36768826db9 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Fri, 26 Dec 2025 17:03:33 +0800 Subject: [PATCH] fix test --- web/app/components/app/overview/settings/index.spec.tsx | 7 +++---- .../pricing/plans/self-hosted-plan-item/index.spec.tsx | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/web/app/components/app/overview/settings/index.spec.tsx b/web/app/components/app/overview/settings/index.spec.tsx index 8deae7f952..41d86047f0 100644 --- a/web/app/components/app/overview/settings/index.spec.tsx +++ b/web/app/components/app/overview/settings/index.spec.tsx @@ -15,11 +15,10 @@ vi.mock('react-i18next', async () => { ...actual, useTranslation: () => ({ t: (key: string, options?: Record) => { + 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', diff --git a/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.spec.tsx b/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.spec.tsx index 610d9264f0..cf2cde82f6 100644 --- a/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.spec.tsx +++ b/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.spec.tsx @@ -16,9 +16,9 @@ const featuresTranslations: Record = { vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string, options?: Record) => { - if (options?.returnObjects) - return featuresTranslations[key] || [] const prefix = options?.ns ? `${options.ns}.` : '' + if (options?.returnObjects) + return featuresTranslations[`${prefix}${key}`] || [] return `${prefix}${key}` }, }),