test(11-05): RED — CR-01 custom alarm round-trip

- expand.test.ts: 3 new tests asserting reminderIsCustom:true for
  absolute DATE-TIME trigger and multi-VALARM, false for relative preset
- EventForm.test.tsx: 3 new tests asserting __custom__ picker init,
  'Custom (kept)' option visibility, and payload omits reminderLeadMinutes
- Fixtures: absolute-alarm.ics (DATE-TIME VALARM), multi-alarm.ics (2 VALARMs)
- All 6 new tests FAIL (RED): reminderIsCustom field not yet on interface
This commit is contained in:
Lucas Berger
2026-06-14 08:08:24 -04:00
parent 6cdf9d22f9
commit 5d6cb47191
4 changed files with 204 additions and 0 deletions
+79
View File
@@ -310,6 +310,85 @@ describe('expandOccurrences', () => {
});
});
describe('reminderIsCustom — CR-01 (Phase 11 Plan 05)', () => {
it('absolute DATE-TIME VALARM trigger yields reminderIsCustom:true and reminderLeadMinutes:null', () => {
// Apple Calendar default all-day alarm style: TRIGGER;VALUE=DATE-TIME:...
// Before the fix, expand.ts maps {kind:'custom'} to null and does NOT set reminderIsCustom.
// This test MUST FAIL before the fix (no reminderIsCustom field on CalendarOccurrence).
const rawVevent = loadFixture('absolute-alarm.ics');
const windowStart = new Date('2026-12-01T00:00:00Z');
const windowEnd = new Date('2027-01-01T00:00:00Z');
const occurrences = expandOccurrences(
rawVevent,
windowStart,
windowEnd,
1,
'My Calendar',
1,
null,
'#4A90D9',
false,
);
expect(occurrences.length).toBe(1);
const occ = occurrences[0];
// reminderIsCustom MUST be true (absolute DATE-TIME trigger)
expect((occ as Record<string, unknown>).reminderIsCustom).toBe(true);
// reminderLeadMinutes MUST be null (cannot reduce custom to a lead)
expect(occ.reminderLeadMinutes).toBeNull();
});
it('multiple VALARMs yield reminderIsCustom:true and reminderLeadMinutes:null', () => {
// Outlook/Apple sometimes produce two VALARMs — classifyValarms returns {kind:'custom'}
const rawVevent = loadFixture('multi-alarm.ics');
const windowStart = new Date('2026-12-01T00:00:00Z');
const windowEnd = new Date('2027-01-01T00:00:00Z');
const occurrences = expandOccurrences(
rawVevent,
windowStart,
windowEnd,
1,
'My Calendar',
1,
null,
'#4A90D9',
false,
);
expect(occurrences.length).toBe(1);
const occ = occurrences[0];
expect((occ as Record<string, unknown>).reminderIsCustom).toBe(true);
expect(occ.reminderLeadMinutes).toBeNull();
});
it('single relative preset VALARM yields reminderIsCustom:false', () => {
// A normal -PT15M DURATION trigger should NOT be flagged as custom
const rawVevent = loadFixture('weekly-dst.ics');
const windowStart = new Date('2026-03-01T00:00:00Z');
const windowEnd = new Date('2026-03-15T00:00:00Z');
const occurrences = expandOccurrences(
rawVevent,
windowStart,
windowEnd,
1,
'My Calendar',
1,
null,
'#4A90D9',
false,
);
// weekly-dst.ics has no VALARM — reminderIsCustom should be false
expect(occurrences.length).toBeGreaterThan(0);
for (const occ of occurrences) {
expect((occ as Record<string, unknown>).reminderIsCustom).toBe(false);
}
});
});
describe('Cross-contract: expand output → Temporal.ZonedDateTime.from (regression guard)', () => {
it('timed event start/end strings from weekly-dst.ics parse via Temporal.ZonedDateTime.from without throwing', () => {
// This is the integration test that was missing. It takes the actual serializeTime output
+14
View File
@@ -0,0 +1,14 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Calendar//NONSGML Version 1//EN
BEGIN:VEVENT
UID:absolute-alarm-test@familysync.test
DTSTART;VALUE=DATE:20261215
SUMMARY:Holiday Party
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Reminder
TRIGGER;VALUE=DATE-TIME:20261214T140000Z
END:VALARM
END:VEVENT
END:VCALENDAR
+20
View File
@@ -0,0 +1,20 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Outlook//NONSGML Version 1//EN
BEGIN:VEVENT
UID:multi-alarm-test@familysync.test
DTSTART:20261215T100000Z
DTEND:20261215T110000Z
SUMMARY:Team Meeting
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Reminder 1
TRIGGER:-PT15M
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Reminder 2
TRIGGER:-PT5M
END:VALARM
END:VEVENT
END:VCALENDAR