import { describe, it, expect } from './runner.js'; import { state } from '../modules/state.js'; // RRULE is set by CalDAV sync, not via PATCH. Test the data model and existing cards. describe('RRULE: Data Model', () => { it('cards with caldav_rrule exist in state (if synced)', () => { const withRrule = state.cards.filter(c => c.caldav_rrule); // May be 0 if no CalDAV configured — just ensure no crash expect(Array.isArray(withRrule)).toBe(true); }); it('birthday cards have geburtstag tag', () => { const birthdays = state.cards.filter(c => (c.tags || '').includes('geburtstag')); for (const b of birthdays) { expect(b.tags).toContain('geburtstag'); // Birthday titles start with date expect(b.title).toMatch(/^\d{4}-\d{2}-\d{2}/); } }); it('termin cards have termin tag', () => { const termine = state.cards.filter(c => (c.tags || '').split(',').includes('termin')); for (const t of termine) { expect(t.tags).toContain('termin'); } }); it('caldav_uid is unique per card', () => { const uids = state.cards.filter(c => c.caldav_uid).map(c => c.caldav_uid); const unique = new Set(uids); expect(unique.size).toBe(uids.length); }); });