feat: v0.9.0 — single-screen 3-pane shell + left Assets pane (wallet/reputation/fleet/time controls) from a single /api/state poll; right pane placeholder
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { formatCash, formatFuel, formatSimClock } from './format';
|
||||
|
||||
describe('formatCash', () => {
|
||||
it('formats EUR with thousands separators and two decimals', () => {
|
||||
expect(formatCash(20_000)).toBe('€20,000.00');
|
||||
expect(formatCash(1_234_567.891)).toBe('€1,234,567.89');
|
||||
});
|
||||
|
||||
it('handles zero and fractional values (refuel costs are fractional)', () => {
|
||||
expect(formatCash(0)).toBe('€0.00');
|
||||
expect(formatCash(30.4)).toBe('€30.40');
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatFuel', () => {
|
||||
it('shows current / max liters with the current value rounded', () => {
|
||||
expect(formatFuel(6300, 6300)).toBe('6300 / 6300 L');
|
||||
expect(formatFuel(1234.6, 6300)).toBe('1235 / 6300 L');
|
||||
expect(formatFuel(0, 6300)).toBe('0 / 6300 L');
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatSimClock', () => {
|
||||
it('formats epoch ms as a UTC wall-clock string (deterministic across timezones)', () => {
|
||||
expect(formatSimClock(Date.UTC(2026, 8, 17, 14, 5))).toBe('2026-09-17 14:05 UTC');
|
||||
expect(formatSimClock(Date.UTC(2026, 0, 1, 0, 0))).toBe('2026-01-01 00:00 UTC');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user