Commit a7ede57
fix: improve test isolation in MiddlewareTest to prevent flakiness
jest.clearAllMocks() resets call counts but not the mockImplementationOnce
queue, which can bleed across tests. Reset global.fetch with a fresh mock
in beforeEach instead of beforeAll to guarantee a clean slate each test.
Also explicitly call PersistedRequests.clear() to reset module-level state
(knownRequestIDs, ongoingRequest, pendingSaveOperations) that Onyx.clear()
alone does not fully reset.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 0dfb543 commit a7ede57
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
0 commit comments