
import ElapsedTime from '../ElapsedTime'

describe('ElapsedTime', () => {
  const constructDate = (hours = 0, minutes = 0, seconds = 0) => {
    return new Date(2000, 0, 1, hours, minutes, seconds)
  }

  const startTime = constructDate()
  const eventTime = constructDate()

  const testbed = createTestbed(ElapsedTime, {
    startTime: startTime,
    eventTime: eventTime
  })

  it('renders the difference in time in mm::ss', () => {
    testbed.render()
    expect(testbed.getText(testbed.rootNode)).to.equal('00:00')
  })

  it('extends to include hh:mm:ss', () => {
    const eventTime = constructDate(1, 2, 3)
    testbed.render({eventTime})
    expect(testbed.getText(testbed.rootNode)).to.equal('01:02:03')
  })
})
