18 lines
463 B
TypeScript
18 lines
463 B
TypeScript
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);
|
|
});
|
|
});
|