Files
Convivo/apps/sidecar/tests/sessionize-poller.test.js
84691de6ee feat: sync GridSmart agendas and use event-relative demo time
Support script and URL sources, automatic Sessionize polling, staff-linked service sessions, chronological agenda blocks, and inline Placeholders. Fix demo mode to use the active event date and document deployed behavior with regression coverage.

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
2026-10-11 08:39:15 +02:00

32 lines
1.2 KiB
JavaScript

const { test } = require('node:test');
const assert = require('node:assert/strict');
const { createSessionizePoller } = require('../src/sessionize-poller');
test('polls events sequentially and isolates upstream failures', async () => {
const calls = [];
const failures = [];
const poll = createSessionizePoller({ listEvents: async () => [{ id: 'first' }, { id: 'second' }],
isBusy: () => false, syncEvent: async id => { calls.push(id); if (id === 'first') throw new Error('unavailable'); },
onError: (error, id) => failures.push(id) });
await poll();
assert.deepEqual(calls, ['first', 'second']);
assert.deepEqual(failures, ['first']);
});
test('does not overlap manual imports or another polling pass', async () => {
let finish;
let reads = 0;
let busy = true;
const pending = new Promise(resolve => { finish = resolve; });
const poll = createSessionizePoller({ listEvents: async () => { reads++; await pending; return []; },
isBusy: () => busy, syncEvent: async () => {}, onError: () => {} });
await poll();
assert.equal(reads, 0);
busy = false;
const first = poll();
await poll();
assert.equal(reads, 1);
finish();
await first;
await poll();
assert.equal(reads, 2);
});