Merge fix-push-test

This commit is contained in:
Claude committed 2026-10-26 23:04:00 +00:00
commit cc064d0ccf
1 file changed
+2 -2
+2 -2
View File
@@ -37,8 +37,8 @@ const users = require('../users'), push = require('../push');
// events: a local event starting in 10 minutes // events: a local event starting in 10 minutes
const soon = new Date(Date.now() + 10 * 60e3), pad = n => String(n).padStart(2, '0'); const soon = new Date(Date.now() + 10 * 60e3), pad = n => String(n).padStart(2, '0');
const st = `${soon.getUTCFullYear()}-${pad(soon.getUTCMonth() + 1)}-${pad(soon.getUTCDate())}T${pad(soon.getUTCHours())}:${pad(soon.getUTCMinutes())}`; const utc = d => d.toISOString().slice(0, 16), st = utc(soon), en = utc(new Date(soon.getTime() + 36e5)); // (the end is built from the real time, so an event just before midnight still ends after it starts)
fs.writeFileSync(path.join(d, 'events.json'), JSON.stringify([{ uid: 'e1', fields: { title: 'Dentist', location: 'Main St', notes: '', allDay: false, start: st, end: st.replace(/T(\d\d)/, (m, h) => 'T' + pad((+h + 1) % 24)), tz: 'UTC', repeat: 'none' }, created: 1, updated: 1 }])); fs.writeFileSync(path.join(d, 'events.json'), JSON.stringify([{ uid: 'e1', fields: { title: 'Dentist', location: 'Main St', notes: '', allDay: false, start: st, end: en, tz: 'UTC', repeat: 'none' }, created: 1, updated: 1 }]));
writePush({ tasks: false }); sent.length = 0; writePush({ tasks: false }); sent.length = 0;
await push.tick(new Date(Date.now() - 3 * 36e5), true); await push.tick(new Date(Date.now() - 3 * 36e5), true);
ok('an event hours away sends nothing', sent.length === 0, sent); ok('an event hours away sends nothing', sent.length === 0, sent);