import { describe, it, expect } from 'vitest'; import { Registration } from './registration'; import { herregistratieDeadline, statusColor, statusLabel } from './registration.policy'; const reg = (status: Registration['status']): Registration => ({ bigNummer: '19012345601', naam: 'Test', beroep: 'Arts', registratiedatum: '2012-09-01', geboortedatum: '1985-03-14', status, }); describe('registration.policy', () => { it('statusLabel echoes the tag', () => { expect(statusLabel('Geregistreerd')).toBe('Geregistreerd'); expect(statusLabel('Doorgehaald')).toBe('Doorgehaald'); expect(statusLabel('Geschorst')).toBe('Geschorst'); }); it('statusColor is total over the union', () => { expect(statusColor('Geregistreerd')).toContain('groen'); expect(statusColor('Doorgehaald')).toContain('rood'); expect(statusColor('Geschorst')).toContain('oranje'); }); it('herregistratieDeadline is only set for an active registration', () => { expect( herregistratieDeadline(reg({ tag: 'Geregistreerd', herregistratieDatum: '2027-01-01' })), ).toEqual(new Date('2027-01-01')); expect( herregistratieDeadline(reg({ tag: 'Doorgehaald', doorgehaaldOp: '2024-05-01', reden: 'x' })), ).toBeNull(); expect( herregistratieDeadline(reg({ tag: 'Geschorst', geschorstTot: '2026-12-31', reden: 'x' })), ).toBeNull(); }); });