Skip to content

Commit a9048d4

Browse files
fix: flaky test hasOutstandingChildRequest
1 parent fbed79d commit a9048d4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tests/actions/ReportTest.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,7 @@ describe('actions/Report', () => {
17461746
...createRandomPolicy(Number(policyID)),
17471747
isPolicyExpenseChatEnabled: true,
17481748
type: CONST.POLICY.TYPE.TEAM,
1749+
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
17491750
harvesting: {
17501751
enabled: false,
17511752
},
@@ -1774,15 +1775,9 @@ describe('actions/Report', () => {
17741775
key: ONYXKEYS.COLLECTION.REPORT,
17751776
waitForCollectionCallback: true,
17761777
callback: (reports) => {
1778+
Onyx.disconnect(connection);
17771779
const createdReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
17781780
const parentPolicyExpenseChat = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`];
1779-
1780-
// Wait until the optimistic data has propagated
1781-
if (!createdReport?.reportID || parentPolicyExpenseChat?.hasOutstandingChildRequest !== true) {
1782-
return;
1783-
}
1784-
1785-
Onyx.disconnect(connection);
17861781
// assert correctness of crucial onyx data
17871782
expect(createdReport?.reportID).toBe(reportID);
17881783
expect(parentPolicyExpenseChat?.hasOutstandingChildRequest).toBe(true);
@@ -1856,6 +1851,7 @@ describe('actions/Report', () => {
18561851
...createRandomPolicy(Number(policyID)),
18571852
isPolicyExpenseChatEnabled: true,
18581853
type: CONST.POLICY.TYPE.TEAM,
1854+
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
18591855
harvesting: {
18601856
enabled: true,
18611857
},
@@ -2075,7 +2071,7 @@ describe('actions/Report', () => {
20752071
ownerAccountID: currentUserAccountID,
20762072
areRulesEnabled: true,
20772073
preventSelfApproval: false,
2078-
autoReportingFrequency: 'immediate',
2074+
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
20792075
harvesting: {
20802076
enabled: false,
20812077
},

0 commit comments

Comments
 (0)