Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(x402): drain limiter awaits in facilitator log-durability test

fudjia725c787f62c2
diff --git a/tests/api/x402-facilitator-log-durable.test.js b/tests/api/x402-facilitator-log-durable.test.js
index c0b7458ee..f8df5269c 100644
--- a/tests/api/x402-facilitator-log-durable.test.js
+++ b/tests/api/x402-facilitator-log-durable.test.js
@@ -50,10 +50,12 @@ describe('self-facilitator log durability', () => {
const res = makeRes();
const done = handler(makeReq({ action: 'verify', body: REQ_BODY }), res);
- // Let the handler run up to the awaited logOp. The INSERT promise is still
- // pending (we haven't resolved it), so the response must NOT have been sent.
- await Promise.resolve();
- await Promise.resolve();
+ // Let the handler run up to the awaited logOp. It first awaits the two
+ // rate-limit buckets (per-IP + global), then verify, then the log INSERT.
+ // Drain enough microtasks to clear the limiter awaits and reach the log
+ // await; the INSERT promise is still pending (we haven't resolved it), so
+ // the response must NOT have been sent.
+ for (let i = 0; i < 6; i++) await Promise.resolve();
expect(res.ended).toBe(false);
expect(pendingResolvers.length).toBe(1); // the log INSERT is in flight