mirror of
https://github.com/balzack/databag.git
synced 2025-04-25 11:05:27 +00:00
11 lines
246 B
TypeScript
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);
|
|
}
|
|
|