From 66ed4f27fe15a024d51b266be8e36110bcace956 Mon Sep 17 00:00:00 2001 From: Ashton Cummings Date: Thu, 20 Sep 2018 12:44:56 -0500 Subject: [PATCH] Added unit tests. --- test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test.js b/test.js index 7ae84f0..14d5d45 100644 --- a/test.js +++ b/test.js @@ -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) })