test: unify i18next mocks into centralized helpers#3
Conversation
Consolidate scattered i18next mock implementations across test files into a single source of truth. This reduces duplication and ensures consistent mock behavior. - Create test/i18n-mock.ts with reusable factory functions - Update vitest.setup.ts to use the centralized helpers - Remove redundant mock definitions from 8 test files - Update testing.md documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…eateReactI18nextMock` and detail global mock provisions.
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| t: createTFunction(translations, localeFromOuter), | ||
| }), | ||
| } | ||
| } |
There was a problem hiding this comment.
Locale parameter incorrectly used as namespace
Low Severity
The createMixedTranslationMock function passes localeFromOuter (a locale like 'zh-Hans') as the defaultNs parameter to createTFunction. This causes the locale to be used as a namespace prefix when calling t('key'), returning 'zh-Hans.key' instead of just 'key'. Locales and namespaces are semantically different concepts - the real useMixedTranslation hook uses locale to select translation sets, not as a namespace prefix. While this function is currently unused, it will produce incorrect behavior if used.
Benchmark PR from qodo-benchmark#129
Note
Unifies i18n mocking across the frontend test suite and removes ad-hoc mocks.
web/test/i18n-mock.tsexposingcreateReactI18nextMockand related helpers foruseTranslation/Transweb/vitest.setup.tsto usecreateReactI18nextMockforreact-i18nextcreateReactI18nextMock(e.g.,inline-delete-confirm,input,input-with-copy, plugins installation specs)Written by Cursor Bugbot for commit f78fd25. Configure here.