import {expect, test} from 'vitest' import {formatValue, niceTicks} from './metricChart' test('picks about five round ticks that include zero', () => { expect(niceTicks(0, 7)).toEqual([0, 2, 4, 6, 8]) expect(niceTicks(0, 100)).toEqual([0, 25, 50, 75, 100]) expect(niceTicks(-3, 3)).toEqual([-4, -2, 0, 2, 4]) }) test('formats values compactly from a thousand up', () => { expect([formatValue(7), formatValue(0.25), formatValue(1500), formatValue(2_000_000), formatValue(12.5)]).toEqual(['7', '0.25', '1.5K', '2M', '12.5']) })