MCPcopy Create free account
hub / github.com/Noumena-Network/code / waitFor

Function waitFor

src/components/Markdown.robustness.test.tsx:61–72  ·  view source on GitHub ↗
(
  predicate: () => boolean,
  message: string,
  timeoutMs = 1500,
)

Source from the content-addressed store, hash-verified

59}
60
61async function waitFor(
62 predicate: () => boolean,
63 message: string,
64 timeoutMs = 1500,
65): Promise<void> {
66 const deadline = Date.now() + timeoutMs
67 while (Date.now() < deadline) {
68 if (predicate()) return
69 await Bun.sleep(10)
70 }
71 throw new Error(message)
72}
73
74async function renderComponent(node: React.ReactNode): Promise<string> {
75 let output = ''

Callers 1

renderComponentFunction · 0.70

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected