import { formatBarcode } from './barcode';

describe('barcode', () => {
  it('formatBarcode with 8 digits', () => {
    expect(formatBarcode('12345678')).toBe('1234 5678');
  });
  it('formatBarcode with 10 digits', () => {
    expect(formatBarcode('1234567890')).toBe('1234 5678 90');
  });
  it('formatBarcode with existing spaces', () => {
    expect(formatBarcode('1234 5678 90')).toBe('1234 5678 90');
  });
  it('formatBarcode with null input', () => {
    expect(formatBarcode('PK://ckazi3ob4pk010173v9465fm5')).toBe('ckaz i3ob 4pk0 1017 3v94 65fm 5');
  });
  it('formatBarcode with null input', () => {
    expect(formatBarcode(null)).toBeUndefined();
  });
});
