[grade=A urn:ump:3n5xljspojvc57x7isxi4busps2dxlpwuzivhntg44i3jkpiqfaa] test(DC-168): make calendar events fixture date-relative (was a time bomb)
The 'failing source degrades to perSource error' test hardcoded DTSTART:20261007T100000Z. The /events route defaults to a now-7d..now+30d window, so the fixture silently expired on 2026-10-14 and this was the single failing test in every full-suite run since. Fixture now builds DTSTART for tomorrow UTC at runtime. Verified: file suite 15/15; full suite 3704/3705 (this was the only failure). Judge A — urn:ump:3n5xljspojvc57x7isxi4busps2dxlpwuzivhntg44i3jkpiqfaa
This commit is contained in:
1 file changed
+7
-1
@@ -176,7 +176,13 @@ describe('DC-161 calendar routes', () => {
|
||||
{ id: 'good', type: 'ics', name: 'Good', url: 'https://good.example.com/c.ics', enabled: true },
|
||||
{ id: 'bad', type: 'ics', name: 'Bad', url: 'https://bad.example.com/c.ics', enabled: true },
|
||||
);
|
||||
const goodIcs = 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:g1\r\nDTSTART:20261007T100000Z\r\nSUMMARY:Good event\r\nEND:VEVENT\r\nEND:VCALENDAR';
|
||||
// Date-relative fixture (was hardcoded 20261007 and silently expired
|
||||
// out of the default now-7d..now+30d window): build DTSTART for
|
||||
// tomorrow UTC so the event is always inside the aggregation window.
|
||||
const ev = new Date(Date.now() + 86400000);
|
||||
const p2 = (n) => String(n).padStart(2, '0');
|
||||
const dtstart = `${ev.getUTCFullYear()}${p2(ev.getUTCMonth() + 1)}${p2(ev.getUTCDate())}T${p2(ev.getUTCHours())}${p2(ev.getUTCMinutes())}00Z`;
|
||||
const goodIcs = 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:g1\r\nDTSTART:' + dtstart + '\r\nSUMMARY:Good event\r\nEND:VEVENT\r\nEND:VCALENDAR';
|
||||
deps.fetchT.mockImplementation(async (url) => {
|
||||
if (url.includes('good')) return { ok: true, status: 200, text: async () => goodIcs };
|
||||
throw new Error('DNS failure');
|
||||
|
||||
Reference in new issue
Block a user