Skip to content

test: unify i18next mocks into centralized helpers#37

Open
tomerqodo wants to merge 6 commits intogreptile_combined_132_qodo_grep_codex_sentry_demo_base_test_unify_i18next_mocks_into_centralized_helpers_pr129from
greptile_combined_132_qodo_grep_codex_sentry_demo_head_test_unify_i18next_mocks_into_centralized_helpers_pr129
Open

test: unify i18next mocks into centralized helpers#37
tomerqodo wants to merge 6 commits intogreptile_combined_132_qodo_grep_codex_sentry_demo_base_test_unify_i18next_mocks_into_centralized_helpers_pr129from
greptile_combined_132_qodo_grep_codex_sentry_demo_head_test_unify_i18next_mocks_into_centralized_helpers_pr129

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#129

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.
@greptile-apps
Copy link

greptile-apps bot commented Jan 10, 2026

Greptile Overview

Greptile Summary

Centralizes i18next mock helpers into a new web/test/i18n-mock.ts module with reusable factory functions. Refactors 17 test files to use the centralized helpers, eliminating ~293 lines of duplicated mock code. Updates documentation and test templates to reference the new helper functions.

Confidence Score: 5/5

  • Safe to merge—excellent refactoring that improves test maintainability without changing functionality
  • This is a pure refactoring that consolidates duplicated i18n mock code into reusable helpers. All test files correctly use the new centralized functions, test assertions were updated to match global mock behavior, and documentation was comprehensively updated. No functional changes to production code.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/test/i18n-mock.ts 5/5 New centralized i18n mock helper module with well-designed factory functions for creating translation mocks
web/vitest.setup.ts 5/5 Updated to use centralized i18n mock helper, reducing code duplication and improving maintainability
web/testing/testing.md 5/5 Updated documentation to reference new centralized i18n mock helpers and usage patterns
.claude/skills/frontend-testing/references/mocking.md 5/5 Updated mocking guide to reference new createReactI18nextMock helper and usage examples
web/app/components/plugins/marketplace/index.spec.tsx 5/5 Removed redundant i18n mock and updated test assertions to match global mock behavior (namespace prefixing)

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Test as Test File
    participant Helper as i18n-mock.ts
    participant Setup as vitest.setup.ts
    
    Dev->>Test: "Write test"
    
    alt Test needs custom translations
        Test->>Helper: "Import createReactI18nextMock"
        Test->>Test: "vi.mock with custom translations"
        Helper-->>Test: "Return mock with translations"
    else Test uses default behavior
        Setup->>Helper: "Import createReactI18nextMock"
        Setup->>Setup: "Setup global mock"
        Test->>Setup: "Use global mock"
        Setup-->>Test: "Keys returned with namespace"
    end
    
    Test->>Test: "Run test assertions"
Loading

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.

3 participants