Commit d63e3de
committed
test: return cleanup handles from AppState and InteractionManager mocks
useAppState.test.ts and useInteractionManager.test.ts each define a local
jest.mock("react-native", ...) that overrides jest.setup.js, so their
mocks returned undefined. The hooks call subscription.remove() and
interactionPromise.cancel() in effect cleanup, which threw during unmount
(TypeError + React "detached tree" internal error). Tests passed only
because the throw was swallowed as console.error.
Return { remove } / { cancel } from both the default mock and the
per-test mockImplementationOnce to honor the real API contract.1 parent b93c00d commit d63e3de
2 files changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
0 commit comments