databag/app/sdk/__mocks__/waitFor.ts
balzack 869b3be540
Some checks are pending
CI / CI (push) Waiting to run
copy over sdk, will attempt incremental merge in branch
2025-03-03 22:04:16 -08:00

11 lines
246 B
TypeScript

export async function waitFor(cond: () => boolean, sec: number = 1): Promise<void> {
for (let i = 0; i < sec * 10; i++) {
if (cond()) {
return;
}
await new Promise(r => setTimeout(r, 100));
}
expect(cond()).toBe(true);
}