feat(03-12): GREEN — WR-03 blank edit, WR-03 recurrence, WR-05 zone-consistent, IN-03

WR-03 blank: add occurrence?.uid to reset effect deps so form re-populates
when occurrence resolves in TanStack cache after form opens.

WR-03 recurrence: derive initial recurrence from occurrence?.recurrence
instead of hard-coding 'none'; defaults to 'none' when absent (v1 comment).

WR-05: rewrite parseDateTime to use getFullYear/getMonth/getDate/getHours/
getMinutes (all local accessors) — never mix toISOString() UTC date with
getHours() local time.

IN-03: export todayIso from calendarStore (was private); import into EventForm
and collapse getDefaultStartDate/getDefaultEndDate to todayIso() calls.
This commit is contained in:
Lucas Berger
2026-06-05 20:40:11 -04:00
parent 02e312acdc
commit f0f1361fba
3 changed files with 47 additions and 30 deletions
+10 -9
View File
@@ -68,6 +68,9 @@ vi.mock('../store/calendarStore.js', () => ({
if (typeof selector === 'function') return selector(state)
return state
}),
// IN-03: todayIso is now exported from calendarStore (gap closure); mock it here
// so EventForm can import it without errors. Returns today as YYYY-MM-DD.
todayIso: () => new Date().toISOString().slice(0, 10),
}))
vi.mock('../api/client.js', () => ({
@@ -601,17 +604,15 @@ describe('EventForm — Plan 03-12 gap closures', () => {
})
// ── IN-03: todayIso exported from calendarStore ───────────────────────────
// This test is structural — we verify the export exists by importing it.
// If todayIso is NOT exported, the import itself will cause a TypeScript/Vite
// module error at test collection time, making the test file fail to load.
// This test is structural — we verify the export exists in the REAL module.
// The calendarStore is mocked in this file via vi.mock(), so we must use
// vi.importActual() to bypass the mock and test the actual export.
it('IN-03: todayIso is exported from calendarStore (single source of truth)', async () => {
// Dynamic import to avoid static TDZ issues and to test export presence
const storeModule = await import('../store/calendarStore.js')
// @ts-expect-error — todayIso is being added as a new export; TypeScript type not yet updated
expect(typeof storeModule.todayIso).toBe('function')
// @ts-expect-error
const result = storeModule.todayIso()
// Use importActual to bypass the vi.mock() and test the real module export
const actualModule = await vi.importActual('../store/calendarStore.js') as Record<string, unknown>
expect(typeof actualModule.todayIso).toBe('function')
const result = (actualModule.todayIso as () => string)()
// Should return a YYYY-MM-DD string
expect(result).toMatch(/^\d{4}-\d{2}-\d{2}$/)
})