MCPcopy Index your code
hub / github.com/angular/angular / testingEffect

Function testingEffect

packages/core/test/signals/effect_util.ts:16–28  ·  view source on GitHub ↗
(
  effectFn: (onCleanup: (cleanupFn: WatchCleanupFn) => void) => void,
)

Source from the content-addressed store, hash-verified

14 * A wrapper around `Watch` that emulates the `effect` API and allows for more streamlined testing.
15 */
16export 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
30export function flushEffects(): void {
31 for (const watch of queue) {

Callers 3

watch_spec.tsFile · 0.90

Calls 5

createWatchFunction · 0.90
bindMethod · 0.65
notifyMethod · 0.65
destroyMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…