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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user