MCPcopy Index your code
hub / github.com/testing-library/react-hooks-testing-library / waitForValueToChange

Function waitForValueToChange

src/core/asyncUtils.ts:63–73  ·  view source on GitHub ↗
(
    selector: () => unknown,
    { interval = DEFAULT_INTERVAL, timeout = DEFAULT_TIMEOUT }: WaitForValueToChangeOptions = {}
  )

Source from the content-addressed store, hash-verified

61 }
62
63 const waitForValueToChange = async (
64 selector: () => unknown,
65 { interval = DEFAULT_INTERVAL, timeout = DEFAULT_TIMEOUT }: WaitForValueToChangeOptions = {}
66 ) => {
67 const initialValue = selector()
68
69 const result = await wait(() => selector() !== initialValue, { interval, timeout })
70 if (!result && timeout) {
71 throw new TimeoutError(waitForValueToChange, timeout)
72 }
73 }
74
75 const waitForNextUpdate = async ({
76 timeout = DEFAULT_TIMEOUT

Callers 1

asyncHook.test.tsFile · 0.85

Calls 1

waitFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…