Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/objectql/src/hook-binder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,13 @@ describe('wrapDeclarativeHook', () => {
},
};
const wrapped = wrapDeclarativeHook(meta, meta.handler as any);
const t0 = Date.now();
await wrapped(makeCtx({ event: 'afterInsert' }));
expect(Date.now() - t0).toBeLessThan(20); // returned before handler finished
// Ordering, not wall clock (#2744): if the wrapper had awaited the
// handler, `calls` would already hold 'done' here — the 30ms timer is a
// macrotask and cannot fire between the wrapper's resolution and this
// synchronous check, no matter how slow the runner is. The old
// `< 20ms` wall-clock assertion was flaky on shared CI machines.
expect(calls).toEqual([]); // returned before handler finished
await new Promise((r) => setTimeout(r, 60));
expect(calls).toEqual(['done']);
});
Expand Down