diff --git a/dashcaddy-api/__tests__/routes/calendar.routes.test.js b/dashcaddy-api/__tests__/routes/calendar.routes.test.js index a35fcad..c18527a 100644 --- a/dashcaddy-api/__tests__/routes/calendar.routes.test.js +++ b/dashcaddy-api/__tests__/routes/calendar.routes.test.js @@ -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');