This commit is contained in:
Andras Schmelczer 2026-09-11 16:58:58 +01:00
commit 62a385e4c9
33 changed files with 2649 additions and 809 deletions

18
tests/format.test.ts Normal file
View file

@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest';
import { cutMm } from '../src/lib/format';
describe('cut dimensions', () => {
it.each([
[0, '0'],
[89.423, '89.5'],
[177.163, '177.5'],
[488.648, '489'],
[545.948, '546'],
[600.5, '600.5'],
[600.50000000001, '600.5'],
[1200, '1,200'],
[NaN, '—'],
])('rounds %s upward to a useful half-millimetre mark', (length, shown) => {
expect(cutMm(length)).toBe(shown);
});
});