MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / waitFor

Function waitFor

apps/desktop/src/main/app-config.test.ts:44–50  ·  view source on GitHub ↗
(pred: () => boolean, timeoutMs: number)

Source from the content-addressed store, hash-verified

42
43const delay = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms))
44async function waitFor(pred: () => boolean, timeoutMs: number): Promise<void> {
45 const start = Date.now()
46 while (!pred()) {
47 if (Date.now() - start > timeoutMs) return
48 await delay(50)
49 }
50}
51
52beforeEach(async () => {
53 homeDir = await tmp('zen-home-')

Callers 1

app-config.test.tsFile · 0.85

Calls 1

delayFunction · 0.85

Tested by

no test coverage detected