import { normalizeStatus, statusTone, statusLabel, PIPELINE_STATUSES } from './pipeline'; describe('pipeline', () => { test('normalizeStatus canonicalizes casing and synonyms', () => { expect(normalizeStatus('applied')).toBe('Applied'); expect(normalizeStatus(' OFFER ')).toBe('Offer'); expect(normalizeStatus('Interviewing')).toBe('Interview'); expect(normalizeStatus('declined')).toBe('Rejected'); }); test('normalizeStatus preserves unknown as Other and empty as Applied', () => { expect(normalizeStatus('Take-home')).toBe('Other'); expect(normalizeStatus('')).toBe('Applied'); expect(normalizeStatus(null)).toBe('Applied'); }); test('statusTone maps stages to palette keys', () => { expect(statusTone('Offer')).toBe('success'); expect(statusTone('Rejected')).toBe('error'); expect(statusTone('Waiting')).toBe('warning'); expect(statusTone('Ghosted')).toBe('warning'); expect(statusTone('Interview')).toBe('info'); expect(statusTone('Applied')).toBe('primary'); expect(statusTone('Take-home')).toBe('default'); }); test('statusLabel localizes canonical and passes through custom', () => { const t = (key: string) => ({ statusApplied: 'Applied', statusOffer: 'Offer' } as Record)[key] ?? key; expect(statusLabel(t, 'Applied')).toBe('Applied'); expect(statusLabel(t, 'Interviewing')).toBe('statusInterview'); // maps to canonical key expect(statusLabel(t, 'Take-home assignment')).toBe('Take-home assignment'); }); test('canonical stage list is stable and ordered', () => { expect(PIPELINE_STATUSES).toEqual(['Applied', 'Waiting', 'Interview', 'Offer', 'Rejected', 'Ghosted']); }); });