Files
portfolio-next/test/site/record.test.ts
T
Lucas WintherandClaude Opus 5.5 974b3eb0df feat(work): CV-first work page, six proud projects, record and courses (spec 009)
- CV header with highlights and keeping-up summary replaces the intro and Now strip
- "Projects I'm proudest of": up to six featured panels; screenshots muted until hover
- "Also made" list; searching it also lists matching courses
- Record section: recognition & volunteering, courses by topic
- /work/learning/: searchable course list (plain script), in the sitemap
- Top bar: Projects, Record, Writing, CV; no Bluesky link in the work footer
- Highlights: only the placement takes the accent (owner, after the preview)

Owner looked at the rendered preview on 2026-11-12 before this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 10:44:46 +01:00

25 lines
1.1 KiB
TypeScript

import { expect, test } from 'bun:test';
import { approxHours, doneText, headerHighlights, hostOf } from '../../src/site/components/work/record.ts';
import type { Recognition } from '../../src/library/types.ts';
const r = (title: string, highlight: boolean): Recognition => ({ title, kind: 'competition', result: 'x', highlight });
test('headerHighlights takes the first three highlighted, counts the rest of the record', () => {
const h = headerHighlights([r('a', true), r('b', false), r('c', true), r('d', true), r('e', true)]);
expect(h.shown.map((x) => x.title)).toEqual(['a', 'c', 'd']);
expect(h.more).toBe(2);
expect(headerHighlights([r('a', false)])).toEqual({ shown: [], more: 1 });
});
test('doneText leaves out a zero part', () => {
expect(doneText(2, 3)).toBe('2 courses · 3 labs');
expect(doneText(1, 0)).toBe('1 course');
expect(doneText(0, 1)).toBe('1 lab');
});
test('approxHours and hostOf', () => {
expect(approxHours(659)).toBe(11);
expect(approxHours(10)).toBe(1);
expect(hostOf('https://www.example.invalid/x')).toBe('example.invalid');
});