openvibers/openvibe.community Commits

Wait for the async inbound failure before asserting it in relay test (#6)

OP OpenVibers committed 2 Oct 2026 · cd34b840ae · 1 file, +2 −0

checks run by GitHub CI (test) · CI ✓ 3/3 · review SHIP by DeepSeek harness

https://github.com/OpenVibers/OpenVibe.Community/pull/6

Changes

ddiff --git a/test/relay-inbound.test.js b/test/relay-inbound.test.js
iindex a1a032d..50c26d3 100644
---- a/test/relay-inbound.test.js
++++ b/test/relay-inbound.test.js
@@@ -319,6 +319,8 @@ const sent = (gw, op) => gw.sockets.flatMap((s) => s.sent).filter((p) => p.op ==
assert.ok(page.text.includes('badge-relay') && page.text.includes('Kim') && page.text.includes('<strong>great</strong>'), 'the reply shows with its Discord badge');
await t.db.prepare('UPDATE threads SET locked = 1').run();
gw.dispatch('MESSAGE_CREATE', { id: locked, channel_id: anchor.external_channel_id, type: 19, content: 'too late', author: { id: KIM, username: 'kim' }, message_reference: { message_id: anchor.external_message_id } });
++ // Handling is async (the gateway queues dispatches): wait for the failure to be recorded before reading it.
++ await waitFor(async () => await t.db.prepare("SELECT 1 FROM relay_inbound_failures WHERE error = 'the thread is locked'").get(), 'the locked reply recorded as a failure');
assert.strictEqual((await call('/api/v1/relay/inbound', { cookie: samJwt })).status, 403);
const inb = await call('/api/v1/relay/inbound', { cookie: adminJwt });
assert.strictEqual(inb.status, 200);