Added unit tests.

This commit is contained in:
Ashton Cummings 2018-09-20 12:44:56 -05:00
parent e0be5577a7
commit 66ed4f27fe

View File

@ -89,6 +89,14 @@ describe('timestring', () => {
expect(() => timestring('1g')).to.throw(Error)
})
it('throws an error when no numbers are in the timestring', () => {
expect(() => timestring('asdf')).to.throw(Error)
})
it('throws an error when numbers tail the timestring', () => {
expect(() => timestring('asdf123')).to.throw(Error)
})
it('can parse a messy time string', () => {
expect(timestring('5 D a YS 4 h 2 0 mI nS')).to.equal(447600)
})