[NoQA] Fix flaky pushTransactionAutoSelectionsOnyxData unit tests - #93962
Merged
mountiny merged 4 commits intoJun 19, 2026
Merged
Conversation
Build PolicyData inline instead of reading it through usePolicyData so tests no longer depend on async Onyx subscriptions and leaked state. Co-authored-by: Cursor <cursoragent@cursor.com>
Transaction does not include policyID, which caused typecheck failures on the PR. Co-authored-by: Cursor <cursoragent@cursor.com>
mountiny
force-pushed
the
fix/flaky-pushTransactionAutoSelections-test-93921
branch
from
June 18, 2026 18:25
f988c3c to
7613fa0
Compare
Remove unused imports and rename buildPolicyData parameter to avoid shadowing the outer policy variable. Co-authored-by: Cursor <cursoragent@cursor.com>
randWord() can return duplicate words, collapsing the categories map to fewer than requested and flipping count-sensitive auto-selection asserts. Append the index suffix, matching createRandomPolicyTags. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Contributor
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
youssef-lr
approved these changes
Jun 19, 2026
Contributor
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.17-0 🚀
Bundle Size Analysis (Sentry): |
Contributor
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀
|
1 similar comment
Contributor
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀
|
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
The
pushTransactionAutoSelectionsOnyxDatatests were flaky because they populated Onyx and then read policy state throughrenderHook(usePolicyData), which depends on async Onyx subscriptions and derived values. Under CI load, stale or incomplete hook data could make the test think only one enabled category remained, causing a spurious auto-selection.These tests exercise pure ReportUtils logic, so they now build a
PolicyDataobject inline (same approach astests/perf-test/ReportUtils.perf-test.ts) instead of going throughusePolicyData. The adjacentpushTransactionViolationsOnyxDatatest was updated the same way for consistency.Fixed Issues
$ #93921
$ #94051
PROPOSAL:
Tests
npx jest tests/unit/ReportUtilsTest.ts -t "pushTransactionAutoSelectionsOnyxData|pushTransactionViolationsOnyxData" --runInBandand verify all 6 tests pass.for i in {1..10}; do npx jest tests/unit/ReportUtilsTest.ts -t "does not auto-select when more than one enabled category remains" --runInBand --silent || break; doneOffline tests
N/A — test-only change with no product behavior impact.
QA Steps
Same as tests.
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-only change.
Android: mWeb Chrome
N/A — test-only change.
iOS: Native
N/A — test-only change.
iOS: mWeb Safari
N/A — test-only change.
MacOS: Chrome / Safari
N/A — test-only change.