Commit 7e9a1d8
Fix flaky test (#735)
fix(react-db): fix flaky test by preventing race condition
The test "optimistic state is dropped after commit" was flaky because it had a race condition:
1. The test would wait for state size to become 4
2. Then immediately check that the temp-key exists
3. However, the async mutation (with only 10ms delay) could complete between steps 1 and 2
Fixed by moving all assertions into the same waitFor() block, ensuring they execute atomically.
This prevents the mutation from completing between the size check and the temp-key verification.
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7b9c681 commit 7e9a1d8
1 file changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
906 | 912 | | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
| |||
0 commit comments