Permalink
Browse files

tests for ms()

  • Loading branch information...
tj committed Mar 21, 2012
1 parent d2d3a23 commit dd8f79a3f49e587fd1528802589cb79c3a595695
Showing with 20 additions and 1 deletion.
  1. +2 −1 Makefile
  2. +18 −0 test/ms.js
View
@@ -1,6 +1,7 @@
test:
@./node_modules/.bin/mocha \
- --require should
+ --require should \
+ --reporter spec
.PHONY: test
View
@@ -0,0 +1,18 @@
+
+var Parser = require('../')
+ , ms = Parser.ms;
+
+describe('ms', function(){
+ it('should parse string ms representations', function(){
+ ms('', '1000ms').should.equal(1000);
+ ms('', '1s').should.equal(1000);
+ ms('', '4 seconds').should.equal(4000);
+ ms('', '4 seconds').should.equal(4000);
+ ms('', '2 minutes').should.equal(2 * 60000);
+ ms('', '1 hour').should.equal(3600000);
+ ms('', '2 days').should.equal(2 * 86400000);
+ ms('', '5y').should.equal(5 * 31557600000);
+ ms('', '1 year').should.equal(31557600000);
+ ms('', '5 years').should.equal(5 * 31557600000);
+ })
+})

0 comments on commit dd8f79a

Please sign in to comment.