Skip to content

Six tests rebuild OTHER_LOCALE by hand as CATALOG_LOCALES.find(l => l !== 'en') ?? 'en' #1119

Backlog

Description

@richshaw

What happens

OTHER_LOCALE in src/i18n/testing/locales.ts is "one test language, the first", and CLAUDE.md says a unit test that works the same in any language uses it rather than naming one. Six tests rebuild it by hand as CATALOG_LOCALES.find((locale) => locale !== 'en') ?? 'en':

  • src/components/magic-compose/warning-text.test.ts
  • src/components/magic-compose/AiDraftBanner.test.tsx
  • src/components/magic-compose/answers.test.ts (as a LOCALE constant)
  • src/components/magic-compose/compose-text.test.tsx (as a LOCALE constant)
  • src/components/signup/SignupHeader.test.tsx (the other in one test)
  • src/services/signups.db.test.ts (the another in one test)

The ?? 'en' fallback is worse than a copy. With no other catalog, these tests quietly run in English and still pass. OTHER_LOCALE throws instead and says why. This is the same clean-up #1083 / #1118 does for TEST_LOCALES.

Fix, in outline

  • Replace each expression with OTHER_LOCALE from @/i18n/testing/locales (or the relative path the file already uses), and drop the local constant where there is one.
  • Drop the CATALOG_LOCALES import wherever it becomes unused.
  • Find them with grep -rnE "CATALOG_LOCALES\.find" src tests.

Watch for

  • These aren't copies, so leave them alone: the two CATALOG_LOCALES.find((other) => other !== locale) in tests/e2e/organizer-language.spec.ts, which pick a language other than the one under test, and SHIPPED.participant.find(...) in the create-and-publish help article and its walkthrough, which pick a shipped language, not a catalog one.
  • The type narrows from CatalogLocale to TestLocale. Check it still typechecks where the value is passed on.
  • Overlap with Use TEST_LOCALES in the tests that rebuilt it by hand #1118: it also touches AiDraftBanner.test.tsx and SignupHeader.test.tsx. Whichever lands second has a small merge to make.
  • Changes tests only. No runtime code moves.

Done when

  • grep -rnE "CATALOG_LOCALES\.find" src tests finds only the two e2e hits above.
  • The same tests run before and after (vitest list on the touched files gives the same names), and they all pass.
  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test pass, plus pnpm test:db for signups.db.test.ts.

Found while reviewing #1118, at 6cac438. I checked each hit against src/i18n/testing/locales.ts. https://claude.ai/code/session_016YZ9ST5DVxZNyWwie56jbd

Activity

  1. added
    enhancement
    good first issue
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuepipeline:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions