Skip to content

Commit cb05c49

Browse files
MelvinBotmountiny
andcommitted
Fix flaky usePendingConciergeResponse unmount test
Use a 10s delay instead of 80ms in the unmount-cleanup test so the timer never races with real wall-clock time under CI load. The test only needs to prove clearTimeout prevents the action — a large pending timer that gets cleared is just as valid as a short one. Co-authored-by: Vit Horacek <mountiny@users.noreply.github.com>
1 parent a370e73 commit cb05c49

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/unit/hooks/usePendingConciergeResponse.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ describe('usePendingConciergeResponse', () => {
9797
});
9898

9999
it('should cancel the timer on unmount and not apply the action', async () => {
100-
// Given a pending concierge response
100+
// Given a pending concierge response with a large delay so the timer never races with unmount under CI load
101101
await Onyx.merge(`${ONYXKEYS.COLLECTION.PENDING_CONCIERGE_RESPONSE}${REPORT_ID}`, {
102102
reportAction: fakeConciergeAction,
103-
displayAfter: Date.now() + SHORT_DELAY,
103+
displayAfter: Date.now() + 10_000,
104104
});
105105
await waitForBatchedUpdates();
106106

@@ -110,8 +110,8 @@ describe('usePendingConciergeResponse', () => {
110110
// When the hook unmounts before the delay
111111
unmount();
112112

113-
// And we wait past the delay
114-
await delay(SHORT_DELAY + 50);
113+
// And we wait long enough to confirm the action was not applied
114+
await delay(150);
115115
await waitForBatchedUpdates();
116116

117117
// Then the action should NOT be in REPORT_ACTIONS (timer was cleaned up)

0 commit comments

Comments
 (0)