Repository navigation
Conversation
Added comprehensive test coverage for `src/shared/i18n.ts`, specifically testing `applyI18nSubs`, `t`, and `plural` utilities. Covered substitution logic, missing keys, singular vs plural rules, and overriding default count substitutions. Co-authored-by: matuyuhi <92073990+matuyuhi@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Fix the types passed in substitutions array for the i18n testing of `plural()`. `t()` expects strings, string arrays, numbers, or number arrays, but typescript validation of `(string | number)[]` triggered an issue due to how multiple elements type infer. Used explicit strings `'1'` and `'3'` in the mock substitutions parameter array to resolve type compilation error (TS2322) running `bun run tsc`. Co-authored-by: matuyuhi <92073990+matuyuhi@users.noreply.github.com>
🎯 What: The testing gap addressed
Missing test coverage for
src/shared/i18n.tsutility functions, specificallyplural,t, andapplyI18nSubs. This ensures translation substitution and pluralization logic handles localization edge cases correctly.📊 Coverage: What scenarios are now tested
applyI18nSubswith 0, 1, and multiple substitutions, plus out-of-bounds indices.tusing mock fallback messages, including success cases with array substitutions, single integer substitutions, and fallback behavior for missing keys.pluralfor standard edge cases (count = 1 vs count != 1 like 0, 2, -1).pluralautomatically passing the count as default substitution.pluraloverriding default substitutions correctly when explicit substitution strings or arrays are passed.✨ Result: The improvement in test coverage
The
src/shared/i18n.tsfile now has robust test coverage ensuring that our pluralization and translation interpolations logic behaves reliably in all identified edge cases.PR created automatically by Jules for task 9366834780091891690 started by @Matuyuhi