Skip to content

test: unify i18next mocks into centralized helpers#3

Open
bar-qodo wants to merge 6 commits intocursor_demo_20260108_20_instances_augment_cursor_2_base_test_unify_i18next_mocks_into_centralized_helpers_pr129from
cursor_demo_20260108_20_instances_augment_cursor_2_head_test_unify_i18next_mocks_into_centralized_helpers_pr129
Open

test: unify i18next mocks into centralized helpers#3
bar-qodo wants to merge 6 commits intocursor_demo_20260108_20_instances_augment_cursor_2_base_test_unify_i18next_mocks_into_centralized_helpers_pr129from
cursor_demo_20260108_20_instances_augment_cursor_2_head_test_unify_i18next_mocks_into_centralized_helpers_pr129

Conversation

@bar-qodo
Copy link
Copy Markdown

@bar-qodo bar-qodo commented Jan 11, 2026

Benchmark PR from qodo-benchmark#129


Note

Unifies i18n mocking across the frontend test suite and removes ad-hoc mocks.

  • Add web/test/i18n-mock.ts exposing createReactI18nextMock and related helpers for useTranslation/Trans
  • Update global web/vitest.setup.ts to use createReactI18nextMock for react-i18next
  • Refactor multiple specs to remove inline i18n mocks or replace them with createReactI18nextMock (e.g., inline-delete-confirm, input, input-with-copy, plugins installation specs)
  • Adjust test expectations to namespace-prefixed keys where applicable (e.g., marketplace tests)
  • Refresh testing docs and component test template to document the global i18n mock and how to override with the helper

Written by Cursor Bugbot for commit f78fd25. Configure here.

hyoban and others added 6 commits December 30, 2025 16:26
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.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),
}),
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants