import { Alignment, pad } from './pad'

describe('pad', () => {
  it('should pad a string to the left by default', () => {
    expect(pad('1', 2)).toBe('1 ')
  })

  it('should pad a string to the right', () => {
    expect(pad('1', 2, Alignment.RIGHT)).toBe(' 1')
  })

  it('should pad a string to the right with a fill character', () => {
    expect(pad('11', 2, Alignment.RIGHT, '0')).toBe('11')
  })

  it('should pad a string to the left with a fill character', () => {
    expect(() => pad('111', 2, Alignment.LEFT, '0')).toThrow()
  })
})
