add first mocha test
This commit is contained in:
parent
09089fa812
commit
60b303f7cb
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
||||
test
|
||||
node_modules
|
||||
|
@ -1,2 +1,6 @@
|
||||
test
|
||||
node_modules
|
||||
.editorconfig
|
||||
.jshintrc
|
||||
Gruntfile.js
|
||||
.DS_Store
|
||||
dist
|
||||
|
@ -11,7 +11,7 @@ module.exports = function(grunt) {
|
||||
uglify: {
|
||||
dist: {
|
||||
files: {
|
||||
'dist/<%= pkg.name %>.min.js': 'src/<%= pkg.name %>.js'
|
||||
'dist/<%= pkg.name %>.min.js': '<%= pkg.name %>.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -21,7 +21,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
files: [
|
||||
'Gruntfile.js',
|
||||
'src/**/*.js',
|
||||
'<%= pkg.name %>.js',
|
||||
'test/**/*.js'
|
||||
]
|
||||
},
|
||||
|
21
test/timestring.js
Normal file
21
test/timestring.js
Normal file
@ -0,0 +1,21 @@
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
var timestring = require('../timestring');
|
||||
|
||||
describe('timestring', function() {
|
||||
it('should expose a method on String.prototype that will attempt to parse the string as a timestring', function(done){
|
||||
var str = '1min';
|
||||
|
||||
// no arguments passed
|
||||
expect(str.parseTime()).to.equal(60);
|
||||
|
||||
// units argument passed
|
||||
expect(str.parseTime('m')).to.equal(1);
|
||||
|
||||
// units + settings argument passed
|
||||
str = '5h';
|
||||
expect(str.parseTime('d', { hoursPerDay: 5 })).to.equal(1);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user