Skip to content

🧪 [testing improvement] Add unit tests for i18n translation functions#5

Open
chuanman2707 wants to merge 4 commits into
mainfrom
test/i18n-11278824115162357285
Open

🧪 [testing improvement] Add unit tests for i18n translation functions#5
chuanman2707 wants to merge 4 commits into
mainfrom
test/i18n-11278824115162357285

Conversation

@chuanman2707
Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
Tests were added for the internationalization (i18n) functions in mhm/src/lib/i18n.ts, including t(), setLocale(), and getLocale().

📊 Coverage: What scenarios are now tested

  • Locale state management (default locale, updating locale, and localStorage integration).
  • t() function translating standard keys.
  • t() function responding correctly when locale is changed.
  • t() falling back to the translation key when a key is not found.
  • t() falling back to default language (vi) when the translation for the current locale is missing.

Result: The improvement in test coverage
The critical t function used heavily throughout the app is now fully unit tested, improving coverage and preventing regressions during future refactors or translation updates.


PR created automatically by Jules for task 11278824115162357285 started by @chuanman2707

…le management

Co-authored-by: chuanman2707 <29907469+chuanman2707@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits April 16, 2026 16:03
…le management

Also fixes a Clippy warning (`clippy::unnecessary_sort_by`) in `groups.rs`
by changing `.sort_by(|a, b| b.1.len().cmp(&a.1.len()))` to
`.sort_by_key(|b| std::cmp::Reverse(b.1.len()))`.

Co-authored-by: chuanman2707 <29907469+chuanman2707@users.noreply.github.com>
…le management

Also fixes a Clippy warning (`clippy::unnecessary_sort_by`) in `groups.rs`
by changing `.sort_by(|a, b| b.1.len().cmp(&a.1.len()))` to
`.sort_by_key(|b| std::cmp::Reverse(b.1.len()))`.

Co-authored-by: chuanman2707 <29907469+chuanman2707@users.noreply.github.com>
Copy link
Copy Markdown
Owner Author

This one is worth keeping, but not merging as-is. The i18n tests are useful, however the PR also includes an unrelated mhm/src-tauri/src/commands/groups.rs change. Please rebase or recut this as a clean test-only PR and it should be straightforward to merge.

@google-labs-jules
Copy link
Copy Markdown
Contributor

This one is worth keeping, but not merging as-is. The i18n tests are useful, however the PR also includes an unrelated mhm/src-tauri/src/commands/groups.rs change. Please rebase or recut this as a clean test-only PR and it should be straightforward to merge.

I have removed the unrelated mhm/src-tauri/src/commands/groups.rs change from this PR to keep it as a clean test-only PR. I've re-committed just the i18n tests.

…le management

Co-authored-by: chuanman2707 <29907469+chuanman2707@users.noreply.github.com>
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.

1 participant