Skip to content

Commit a1a7870

Browse files
authored
Merge pull request #76214 from Expensify/michal-flaky-reporttest
2 parents 79bea3b + 2ccf957 commit a1a7870

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/actions/ReportTest.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,9 +1774,15 @@ describe('actions/Report', () => {
17741774
key: ONYXKEYS.COLLECTION.REPORT,
17751775
waitForCollectionCallback: true,
17761776
callback: (reports) => {
1777-
Onyx.disconnect(connection);
17781777
const createdReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
17791778
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);
17801786
// assert correctness of crucial onyx data
17811787
expect(createdReport?.reportID).toBe(reportID);
17821788
expect(parentPolicyExpenseChat?.hasOutstandingChildRequest).toBe(true);

0 commit comments

Comments
 (0)