( effectFn: (onCleanup: (cleanupFn: WatchCleanupFn) => void) => void, )
| 14 | * A wrapper around `Watch` that emulates the `effect` API and allows for more streamlined testing. |
| 15 | */ |
| 16 | export function testingEffect( |
| 17 | effectFn: (onCleanup: (cleanupFn: WatchCleanupFn) => void) => void, |
| 18 | ): () => void { |
| 19 | const w = createWatch(effectFn, queue.add.bind(queue), true); |
| 20 | |
| 21 | // Effects start dirty. |
| 22 | w.notify(); |
| 23 | |
| 24 | return () => { |
| 25 | queue.delete(w); |
| 26 | w.destroy(); |
| 27 | }; |
| 28 | } |
| 29 | |
| 30 | export function flushEffects(): void { |
| 31 | for (const watch of queue) { |
no test coverage detected
searching dependent graphs…