Skip to content

Commit aa2475b

Browse files
committed
internal: Less chance of test race conditions
1 parent a5086c4 commit aa2475b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react/src/__tests__/integration-optimistic-endpoint.web.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ describe.each([
462462
],
463463
},
464464
);
465+
await act(async () => {
466+
await new Promise(resolve => setTimeout(resolve, 0));
467+
});
465468

466469
const fetches: Promise<any>[] = [];
467470
const resolves: ((v: any) => void)[] = [];
@@ -493,7 +496,7 @@ describe.each([
493496
}),
494497
);
495498
await act(async () => {
496-
await new Promise(resolve => setTimeout(resolve, 0));
499+
await new Promise(resolve => setTimeout(resolve, 1));
497500
});
498501

499502
// second optimistic
@@ -607,6 +610,9 @@ describe.each([
607610
],
608611
},
609612
);
613+
await act(async () => {
614+
await new Promise(resolve => setTimeout(resolve, 1));
615+
});
610616

611617
const fetches: Promise<any>[] = [];
612618
const resolves: ((v: any) => void)[] = [];

0 commit comments

Comments
 (0)