feat: wayfinding system across chapters, HUD and project plates; cut boot log, headlight and ops strip
This commit is contained in:
@@ -1,21 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { bucharestClock, uptimeSince } from '@/lib/operations';
|
||||
|
||||
describe('uptimeSince', () => {
|
||||
const start = new Date('2025-08-01T00:00:00Z');
|
||||
it('is zero at the start', () => {
|
||||
expect(uptimeSince(start, start)).toEqual({ months: 0, days: 0 });
|
||||
});
|
||||
it('counts whole months and remaining days', () => {
|
||||
expect(uptimeSince(start, new Date('2026-10-10T00:00:00Z'))).toEqual({ months: 14, days: 9 });
|
||||
});
|
||||
it('clamps to zero before the start', () => {
|
||||
expect(uptimeSince(start, new Date('2025-01-01T00:00:00Z'))).toEqual({ months: 0, days: 0 });
|
||||
});
|
||||
});
|
||||
import { bucharestClock } from '@/lib/operations';
|
||||
|
||||
describe('bucharestClock', () => {
|
||||
it('formats HH:MM in Europe/Bucharest', () => {
|
||||
expect(bucharestClock(new Date('2026-01-15T10:05:00Z'))).toBe('12:05');
|
||||
});
|
||||
it('follows daylight saving time', () => {
|
||||
expect(bucharestClock(new Date('2026-07-15T10:05:00Z'))).toBe('13:05');
|
||||
});
|
||||
});
|
||||
|
||||
14
tests/unit/route-plate.test.ts
Normal file
14
tests/unit/route-plate.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { routePlate } from '@/lib/route-plate';
|
||||
|
||||
describe('routePlate', () => {
|
||||
it('combines the chapter exit, position and real project fields', () => {
|
||||
expect(routePlate('05', 0, { visibility: 'private', maturity: 'active' })).toBe('05.1 / PRIVATE / ACTIVE');
|
||||
});
|
||||
it('spells multi-word maturity values without hyphens', () => {
|
||||
expect(routePlate('06', 2, { visibility: 'public', maturity: 'work-in-progress' })).toBe('06.3 / PUBLIC / WORK IN PROGRESS');
|
||||
});
|
||||
it('falls back to the position when no exit is known', () => {
|
||||
expect(routePlate(undefined, 1, { visibility: 'public', maturity: 'learning' })).toBe('2 / PUBLIC / LEARNING');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user