🐛 fix NotFound.test.tsx: add i18n mock for t() translation keys#19325
Conversation
PR #19321 wrapped NotFound.tsx raw strings in t() calls but did not update the test. This adds the react-i18next mock following the same pattern used by other test files. Fixes #19323 Signed-off-by: GitHub Copilot Scanner <scanner@kubestellar.io> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
✅ Test Coverage CheckAll new source files in this PR have corresponding test files. Checked |
There was a problem hiding this comment.
Pull request overview
This PR updates the NotFound component test suite to mock react-i18next so the tests continue to validate the rendered English copy after NotFound.tsx switched to t() translation keys.
Changes:
- Added a
react-i18nextmock inNotFound.test.tsxwith at()function returning English strings. - Updated one assertion to match the rendered em dash character in the NotFound description text.
| const map: Record<string, string> = { | ||
| 'notFound.title': 'Page not found', | ||
| 'notFound.pathDoesNotExist': "doesn't exist yet — but it could!", | ||
| 'notFound.shipFast': 'Ship it in hours, not months', | ||
| 'notFound.aiAutomation': 'KubeStellar Console uses AI-powered repo automation to go from feature request to production in hours. Open an issue and watch the magic happen.', | ||
| 'notFound.requestFeature': 'Request this feature', | ||
| 'notFound.popularPages': 'Popular pages', | ||
| 'notFound.goBack': 'Go back', | ||
| 'notFound.home': 'Home', | ||
| 'notFound.quickLinks.dashboard': 'Dashboard', | ||
| 'notFound.quickLinks.clusters': 'Clusters', | ||
| 'notFound.quickLinks.compliance': 'Compliance', | ||
| 'notFound.quickLinks.deploy': 'Deploy', | ||
| 'notFound.quickLinks.marketplace': 'Marketplace', | ||
| 'notFound.quickLinks.cost': 'Cost', | ||
| } | ||
| return map[key] || key |
Component used nonexistent keys (description, ctaTitle, ctaDescription, ctaButton, quickLinks.*) — corrected to match actual common.json keys (pathDoesNotExist, shipFast, aiAutomation, requestFeature, notFound.quickLinks.*). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: clubanderson <clubanderson@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Hive Scanner <hive-scanner@kubestellar.local>
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Fixes #19323
PR #19321 wrapped NotFound.tsx raw strings in
t()calls but did not update the test file. This adds thereact-i18nextmock following the same pattern used by other test files (e.g., ACMMIntroModal.test.tsx).Changes
vi.mock('react-i18next')toNotFound.test.tsxcommon.jsonTranslation keys mapped
notFound.title→ "Page not found"notFound.pathDoesNotExist→ "doesn't exist yet — but it could!"notFound.shipFast→ "Ship it in hours, not months"notFound.aiAutomation→ Full automation descriptionnotFound.requestFeature→ "Request this feature"notFound.popularPages→ "Popular pages"notFound.goBack→ "Go back"notFound.home→ "Home"notFound.quickLinks.*→ Dashboard, Clusters, Compliance, Deploy, Marketplace, Cost