import { to12h } from './time-12h';

describe('to12h', () => {
  it('converts 24h HH:MM to AM/PM without a leading zero', () => {
    expect(to12h('09:00')).toBe('9:00 AM');
    expect(to12h('00:05')).toBe('12:05 AM');
    expect(to12h('12:30')).toBe('12:30 PM');
    expect(to12h('18:20:00')).toBe('6:20 PM');
  });

  it('returns empty for empty input and echoes non-times', () => {
    expect(to12h(null)).toBe('');
    expect(to12h('TBC')).toBe('TBC');
  });
});
