import { describe, it, expect } from 'vitest'; import { getAccentConfig } from './eventCardConfig'; import type { components } from '$lib/generated/api'; type TimelineEntryDTO = components['schemas']['TimelineEntryDTO']; function event(overrides: Partial): TimelineEntryDTO { return { kind: 'EVENT', precision: 'YEAR', derived: false, senderName: '', receiverName: '', ...overrides }; } describe('getAccentConfig', () => { it('maps a derived birth to the * glyph and "Geburt"', () => { const cfg = getAccentConfig(event({ derived: true, derivedType: 'BIRTH' })); expect(cfg.glyph).toBe('*'); expect(cfg.label).toBe('Geburt'); expect(cfg.accent).toBe('derived'); }); it('maps a derived death to the † glyph and "Tod"', () => { const cfg = getAccentConfig(event({ derived: true, derivedType: 'DEATH' })); expect(cfg.glyph).toBe('†'); expect(cfg.label).toBe('Tod'); expect(cfg.accent).toBe('derived'); }); it('maps a derived marriage to the ⚭ glyph and "Heirat"', () => { const cfg = getAccentConfig(event({ derived: true, derivedType: 'MARRIAGE' })); expect(cfg.glyph).toBe('⚭'); expect(cfg.label).toBe('Heirat'); expect(cfg.accent).toBe('derived'); }); it('maps a HISTORICAL event to the world glyph and "Weltgeschehen"', () => { const cfg = getAccentConfig(event({ type: 'HISTORICAL' })); expect(cfg.glyph).toBe('◍'); expect(cfg.label).toBe('Weltgeschehen'); expect(cfg.accent).toBe('historical'); }); it('maps a curated PERSONAL event to the ★ glyph and "Familie"', () => { const cfg = getAccentConfig(event({ type: 'PERSONAL', eventId: 'e-1' })); expect(cfg.glyph).toBe('★'); expect(cfg.label).toBe('Familie'); expect(cfg.accent).toBe('curated'); }); });