forked from FrankFang/wtf-weekly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
44 lines (32 loc) · 1.08 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
38
39
40
41
42
43
44
var target = require('./')
var assert = require('assert')
console.log('test startOfWeek')
!function(){
var startOfWeek = target.startOfWeek
var date, result
date = new Date(2016,11,5, 23,23,0)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,6)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,7)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,8)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,9)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,10)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,11)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,5, 0,0,0))
date = new Date(2016,11,12)
result = startOfWeek(date)
assert.equal(+result, +new Date(2016,11,12, 0,0,0))
}()
console.log('all ok')