getAccentConfig(entry) maps each EVENT to its glyph (* / † / ⚭ / ★ / ◍), German redundant-cue label, and accent kind (REQ-007/008/018). test-factories build TimelineEntryDTO/TimelineDTO mirroring the real wire shape for component specs. Refs #779 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import type { components } from '$lib/generated/api';
|
|
|
|
type TimelineEntryDTO = components['schemas']['TimelineEntryDTO'];
|
|
type TimelineYearDTO = components['schemas']['TimelineYearDTO'];
|
|
type TimelineDTO = components['schemas']['TimelineDTO'];
|
|
|
|
/**
|
|
* Builds a `TimelineEntryDTO` mirroring the real wire shape (no `year`,
|
|
* `description`, or `snippet` fields). Defaults to a dated DAY-precision letter;
|
|
* override `kind`/`derived`/`type`/`derivedType` etc. for events.
|
|
*/
|
|
export function makeEntry(overrides: Partial<TimelineEntryDTO> = {}): TimelineEntryDTO {
|
|
return {
|
|
kind: 'LETTER',
|
|
precision: 'DAY',
|
|
derived: false,
|
|
senderName: 'Karl Raddatz',
|
|
receiverName: 'Elfriede Raddatz',
|
|
eventDate: '1915-06-15',
|
|
title: 'Brief aus dem Feld',
|
|
documentId: '11111111-1111-1111-1111-111111111111',
|
|
...overrides
|
|
};
|
|
}
|
|
|
|
export function makeYear(year: number, entries: TimelineEntryDTO[]): TimelineYearDTO {
|
|
return { year, entries };
|
|
}
|
|
|
|
export function makeTimelineDTO(
|
|
opts: { years?: TimelineYearDTO[]; undated?: TimelineEntryDTO[] } = {}
|
|
): TimelineDTO {
|
|
return { years: opts.years ?? [], undated: opts.undated ?? [] };
|
|
}
|