-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
37 lines (34 loc) · 1.39 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* current-day-number <https://github.com/datetime/current-day-number>
*
* Copyright (c) 2014-2015 Charlike Mike Reagent, contributors.
* Released under the MIT license.
*/
'use strict';
var assert = require('assert');
var currentDayNumber = require('./index');
describe('current-day-number:', function() {
it('should be greater than 177 or 1 (june 27, 2014 - released)', function(done) {
assert.strictEqual(typeof currentDayNumber(), 'number');
done();
});
it('should be 218 for "August 07, 2015" and 47 for "02/16/2015"', function(done) {
assert.strictEqual(currentDayNumber('March 24, 2015'), 83);
assert.strictEqual(currentDayNumber('03/24/2016'), 84);
assert(currentDayNumber('August 07, 2015') >= 218);
assert.strictEqual(currentDayNumber('02/16/2015'), 47);
assert.strictEqual(currentDayNumber('12/15/2014'), 349);
done();
});
it('should get current day number when empty string format', function(done) {
assert.strictEqual(typeof currentDayNumber(''), 'number');
done();
});
it('should get current day number, if Date format string is invalid', function(done) {
assert.strictEqual(typeof currentDayNumber(/regex/g), 'number');
assert.strictEqual(typeof currentDayNumber(true), 'number');
assert.strictEqual(typeof currentDayNumber(false), 'number');
assert.strictEqual(typeof currentDayNumber(222), 'number');
done();
});
});