-
-
Notifications
You must be signed in to change notification settings - Fork 12.9k
✅ test: add unit test for src/server/translation.ts #7268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
👍 @gru-agent[bot] Thank you for raising your pull request and contributing to our Community |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
1 similar comment
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
1 similar comment
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
1 similar comment
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
1 similar comment
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
1 similar comment
🔄 Rebasing Testgru per ... |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
1 similar comment
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
1 similar comment
🔄 Rebasing Testgru per ... |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
❌ Rebase test pr failed: Error: Pull request #7268 has conflicts. you can use |
🔄 Rebasing Testgru per ... |
Trigger Info
Summary
This PR refactors the
translation.test.ts
file to simplify and improve the testing process for translations. Key changes include:Removed Node.js
fs
andpath
mocks: The tests no longer rely on file system operations or path manipulation. Instead, translation files are directly mocked usingvi.mock
.Added direct mocks for translation files: Mocked translation files (
en-US
,zh-CN
, and default translations) are now imported directly, improving clarity and reducing complexity.Updated fallback logic tests: Tests for fallback behavior now focus on mocked imports rather than file existence checks.
Improved error handling tests: Tests for handling import errors were added to ensure graceful fallback when an invalid locale is provided.
Simplified dev mode behavior: Tests now verify that
zh-CN
translations are used in development mode for thezh-CN
locale.These changes streamline the testing process, remove unnecessary dependencies, and improve maintainability.
Coverage
The change in coverage value, such as:
0% -> 50%
, indicates that the coverage was 0% before writing the tests and 50% after writing them.https://web.dev/articles/ta-code-coverage
Test Statuses
Tip
You can
@gru-agent
and leave your feedback. TestGru will make adjustments based on your inputTip
You can
@gru-agent rebase
to rebase the PR.Tip
You can
@gru-agent redo
to reset or rebase before redoing the PR.Tip
To modify the test code yourself, click here Edit Test Code