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

Function waitUntil

src/services/api/referral.test.ts:130–142  ·  view source on GitHub ↗
(
  predicate: () => boolean,
  timeoutMs = 3000,
)

Source from the content-addressed store, hash-verified

128}
129
130async function waitUntil(
131 predicate: () => boolean,
132 timeoutMs = 3000,
133): Promise<void> {
134 const deadline = Date.now() + timeoutMs
135 while (Date.now() < deadline) {
136 if (predicate()) {
137 return
138 }
139 await new Promise(resolve => setTimeout(resolve, 10))
140 }
141 throw new Error('Timed out waiting for background referral refresh')
142}
143
144function makeEligibility(eligible: boolean, remainingPasses: number) {
145 return {

Callers 1

referral.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected