import { describe, it, expect } from 'vitest'; import { FinishFormatter } from './FinishFormatter'; describe('FinishFormatter', () => { describe('format', () => { it('should format position as "P1"', () => { expect(FinishFormatter.format(1)).toBe('P1'); }); it('should format position as "P2"', () => { expect(FinishFormatter.format(2)).toBe('P2'); }); it('should format position as "P10"', () => { expect(FinishFormatter.format(10)).toBe('P10'); }); it('should handle null value', () => { expect(FinishFormatter.format(null)).toBe('—'); }); it('should handle undefined value', () => { expect(FinishFormatter.format(undefined)).toBe('—'); }); it('should handle decimal positions', () => { expect(FinishFormatter.format(5.5)).toBe('P5'); }); it('should handle large positions', () => { expect(FinishFormatter.format(100)).toBe('P100'); }); }); describe('formatAverage', () => { it('should format average as "P5.4"', () => { expect(FinishFormatter.formatAverage(5.4)).toBe('P5.4'); }); it('should format average as "P10.0"', () => { expect(FinishFormatter.formatAverage(10.0)).toBe('P10.0'); }); it('should handle null value', () => { expect(FinishFormatter.formatAverage(null)).toBe('—'); }); it('should handle undefined value', () => { expect(FinishFormatter.formatAverage(undefined)).toBe('—'); }); it('should handle decimal averages', () => { expect(FinishFormatter.formatAverage(5.123)).toBe('P5.1'); }); it('should handle large averages', () => { expect(FinishFormatter.formatAverage(100.5)).toBe('P100.5'); }); }); });