test: unify i18next mocks into centralized helpers#7
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| changeLanguage: vi.fn(), | ||
| }, | ||
| }), | ||
| } |
There was a problem hiding this comment.
useTranslation mock ignores defaultNs parameter
Low Severity
The createUseTranslationMock function creates a useTranslation mock that doesn't accept any parameters (line 41), but createTFunction was designed to receive a defaultNs parameter (line 10). This means the defaultNs parameter in createTFunction can never receive a value through useTranslation('namespace'). While this doesn't break current tests (the codebase uses inline { ns: 'namespace' } options instead), it's inconsistent with the documented i18next pattern and creates dead code.
Benchmark PR from agentic-review-benchmarks#7
Note
Unifies frontend i18n mocking across tests and clarifies mocking guidance.
web/test/i18n-mock.tswithcreateReactI18nextMock,createUseTranslationMock,createTransMock, andcreateTFunctionweb/vitest.setup.tsto use the shared helper*.spec.tsxfiles to remove ad-hocreact-i18nextmocks, use the helper, and adjust expectations for namespace-prefixed keys.claude/.../mocking.md,web/testing/testing.md, component test template) to document the global i18n mock and override patternWritten by Cursor Bugbot for commit 3c622b1. Configure here.