Conversation
…romises The mock imported RESULTS from react-native-permissions/dist/commonjs/permissions, but that module only exports PERMISSIONS. RESULTS lives in a separate module (dist/commonjs/results), so it was always undefined at runtime. Additionally, the mock check() and request() functions returned plain strings instead of Promises, which doesn't match the real API contract and caused getLocationPermission().then() to fail. This fixes the flaky IOURequestStepConfirmationPageTest failure that has been affecting multiple unrelated PRs on main. Co-authored-by: Marc Glasser <marcaaron@users.noreply.github.com>
Add setNavigationActionToMicrotaskQueue to the Navigation mock (consistent with all other test files) and await batched updates after the button press so the async createTransaction → requestMoney call chain completes before the assertion runs. Co-authored-by: Marc Glasser <marcaaron@users.noreply.github.com>
|
Fixed the failing
All 13 tests in the file now pass. |
|
@ShridharGoel 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
…stead of defining inline Co-authored-by: Monil Bhavsar <MonilBhavsar@users.noreply.github.com>
|
Thanks for the PR, typecheck is failing though |
The import from 'react-native-permissions/dist/commonjs/results' has no type declaration file, causing TS7016. Define the RESULTS object inline with 'as const' instead, which matches the runtime values and provides proper type safety. Co-authored-by: Monil Bhavsar <MonilBhavsar@users.noreply.github.com>
|
Fixed the failing typecheck: The import of |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
Oh, jest8 is also broken 🤦 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
4f689c6
…MockAndLintThreshold Co-authored-by: Monil Bhavsar <MonilBhavsar@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Monil Bhavsar <MonilBhavsar@users.noreply.github.com>
|
Fixed the failing |
This comment was marked as outdated.
This comment was marked as outdated.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.38-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.38-4 🚀
|
Explanation of Change
The
__mocks__/react-native-permissions.tsmock file was importingRESULTSfromreact-native-permissions/dist/commonjs/permissions, but that sub-module only exportsPERMISSIONS— notRESULTS.RESULTSis defined in a separate module (dist/commonjs/results), so it was alwaysundefinedat runtime in the mock.This caused the flaky
IOURequestStepConfirmationPageTestfailure (TypeError: Cannot read properties of undefined (reading 'GRANTED')) that has been affecting multiple unrelated PRs on main.Additionally, the mock's
check()andrequest()functions returned plain strings instead of Promises, which doesn't match the realreact-native-permissionsAPI contract. This causedgetLocationPermission().then(...)to crash with(...).then is not a functionwhen the code path was hit.This PR:
RESULTSinline in the mock (with correct values andas constfor type safety), avoiding the broken importcheck()andrequest()return values inPromise.resolve()to match the real APIFixed Issues
$ #85142
$ #85136
$ #85128
$ #85060
Tests
npx jest tests/ui/components/IOURequestStepConfirmationPageTest.tsx --no-cachenpx jest tests/ui/IOURequestStepScanTest.tsx tests/ui/NewChatPageTest.tsx tests/ui/AssignCardFeed.tsx --no-cachenpx eslint __mocks__/react-native-permissions.ts@typescript-eslint/no-unsafe-member-accesserrors due to undefinedRESULTS)Offline tests
N/A — this change only affects test mocks, not runtime behavior.
QA Steps
[No QA] — this is a test infrastructure fix only. No production code is changed.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
N/A — test mock change only
Android: mWeb Chrome
N/A — test mock change only
iOS: Native
N/A — test mock change only
iOS: mWeb Safari
N/A — test mock change only
MacOS: Chrome / Safari
N/A — test mock change only