Repository navigation
[No QA] Mock fetch in useGettingStartedItems tests so GetRules stays off the network - #103033
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. |
mountiny
marked this pull request as ready for review
October 5, 2026 13:17
melvin-bot
Bot
requested review from
mananjadhav
and removed request for
a team
October 5, 2026 13:17
|
@mananjadhav 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] |
mjasikowski
approved these changes
Oct 5, 2026
Contributor
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
45 tasks done
44 of 45 tasks
93 tasks done
Contributor
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.3-0 🚀
|
44 of 45 tasks
Contributor
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.3-4 🚀
Bundle Size Analysis (Sentry): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
useGettingStartedItemscallsuseRulesPrefetch, which sends aGetRulesrequest when the workspace has rules enabled. The hook tests never mockedfetch, so the 9 tests that enable rules sent that request to the expofetchpolyfill. Under jsdom that polyfill throwsReferenceError: Request is not defined. Whether the rejection lands inside a running test depends on timing, so jest (job 1) fails onmainsome of the time.This PR sets
global.fetch = getGlobalFetchMock()in the test file'sbeforeEach, the same pattern other hook tests use.GetRulesnow resolves against the mock and the tests are deterministic. No app code changes.Fixed Issues
$ #103031
PROPOSAL: N/A
Tests
mainand runnpx jest tests/unit/hooks/useGettingStartedItems.test.ts.row 4 - Set up spend rulesanditem orderingfail withReferenceError: Request is not defined.Offline tests
N/A. This PR changes only a unit test.
QA Steps
None. This PR changes only a unit test, and the title includes "[No QA]".
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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