Skip to content

test: unify i18next mocks into centralized helpers#7

Open
tomerqodo wants to merge 5 commits intocodex_full_base_test_unify_i18next_mocks_into_centralized_helpers_pr7from
codex_full_head_test_unify_i18next_mocks_into_centralized_helpers_pr7
Open

test: unify i18next mocks into centralized helpers#7
tomerqodo wants to merge 5 commits intocodex_full_base_test_unify_i18next_mocks_into_centralized_helpers_pr7from
codex_full_head_test_unify_i18next_mocks_into_centralized_helpers_pr7

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#7

hyoban and others added 5 commits January 25, 2026 12:05
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

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c622b17ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/test/i18n-mock.ts
import * as React from 'react'
import { vi } from 'vitest'

interface TranslationMap extends Record<string, string | string[]> {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace interface with type alias to satisfy lint rule

The new helper declares interface TranslationMap ..., but the repo-level AGENTS.md rule "TypeScript Must Use Type Definitions Instead of Interfaces" (ts/consistent-type-definitions) treats this as a lint error. That means this change can fail CI/lint checks for the web tests. Switch this to a type TranslationMap = Record<...> to align with the enforced rule.

Useful? React with 👍 / 👎.

Comment thread web/test/i18n-mock.ts
Comment on lines +23 to +27
// Serialize params (excluding ns) for test assertions
const params = { ...options }
delete params.ns
const suffix = Object.keys(params).length > 0 ? `:${JSON.stringify(params)}` : ''
return `${fullKey}${suffix}`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle returnObjects in mocked t function

The new createTFunction always falls back to a string (and JSON-serialized options) even when options.returnObjects is passed. Components like SelfHostedPlanItem/List call t(..., { returnObjects: true }) and then do .map(...) on the result, so any test that relies on the global mock (without a local override) will now throw features.map is not a function. Consider special-casing returnObjects (e.g., return an array of keys or an empty array) to preserve prior behavior.

Useful? React with 👍 / 👎.

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