Repository navigation
Backlog
Labels
Description
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.tssrc/components/magic-compose/AiDraftBanner.test.tsxsrc/components/magic-compose/answers.test.ts(as aLOCALEconstant)src/components/magic-compose/compose-text.test.tsx(as aLOCALEconstant)src/components/signup/SignupHeader.test.tsx(theotherin one test)src/services/signups.db.test.ts(theanotherin 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_LOCALEfrom@/i18n/testing/locales(or the relative path the file already uses), and drop the local constant where there is one. - Drop the
CATALOG_LOCALESimport 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)intests/e2e/organizer-language.spec.ts, which pick a language other than the one under test, andSHIPPED.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
CatalogLocaletoTestLocale. 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.tsxandSignupHeader.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 testsfinds only the two e2e hits above.- The same tests run before and after (
vitest liston the touched files gives the same names), and they all pass. pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm testpass, pluspnpm test:dbforsignups.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