[No QA] Fix isActiveRoute flaky test#74164
Conversation
|
@linhvovan29546 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors a navigation test from using a parameterized test.each approach to a single it test block that contains multiple assertions. The change consolidates test cases for the isActiveRoute function into one test case with multiple expect statements.
Key Changes
- Removed the
testimport from@jest/globals(line 1) - Converted parameterized
test.eachstructure to a singleittest block - Added an additional test case for
'settings/preferences/'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(Navigation.isActiveRoute('settings/profile' as Route)).toBe(true); | ||
| expect(Navigation.isActiveRoute('settings/profile/' as Route)).toBe(true); | ||
| expect(Navigation.isActiveRoute('settings/profile?param=1' as Route)).toBe(true); | ||
| expect(Navigation.isActiveRoute('settings/profile/display-name' as Route)).toBe(false); | ||
| expect(Navigation.isActiveRoute('settings/profile/display-name/' as Route)).toBe(false); | ||
| expect(Navigation.isActiveRoute('settings/preferences' as Route)).toBe(false); | ||
| expect(Navigation.isActiveRoute('settings/preferences/' as Route)).toBe(false); | ||
| expect(Navigation.isActiveRoute('report' as Route)).toBe(false); | ||
| expect(Navigation.isActiveRoute('report/123/' as Route)).toBe(false); | ||
| expect(Navigation.isActiveRoute('report/123' as Route)).toBe(false); |
There was a problem hiding this comment.
Consolidating multiple test cases into a single test block reduces test granularity and makes it harder to identify which specific route check fails. When one assertion fails, subsequent assertions won't run, and the test output won't clearly indicate which route caused the failure. Consider using test.each or separate test cases to maintain better test isolation and clearer failure reporting.
There was a problem hiding this comment.
The error line would tell which assertion is failing, so it should be fine
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.2.44-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.2.44-5 🚀
|
Explanation of Change
We were unnecessarily rendering
TestNavigationContainer9 times that could cause SIGTERM. This PR attempts to fix itFixed Issues
$ #74081
PROPOSAL:
Tests
npm test -- tests/navigation/isActiveRouteTests.tsxOffline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop