-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
47 lines (43 loc) · 757 Bytes
/
test.ts
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
45
46
47
import reiwa from './'
import test from 'tape'
test('reiwa is null', (t) => {
const tests = [
'2019-04-01',
'2019-04-30',
'2019-03-15',
'2018-10-21'
]
for (const date of tests) {
t.equal(reiwa(new Date(date)), null, date)
}
t.end()
})
test('reiwa', (t) => {
const tests = [{
date: '2019-05-01',
expected: 1
}, {
date: '2019-05-02',
expected: 1
}, {
date: '2020-01-01',
expected: 2
}, {
date: '2022-08-21',
expected: 4
}, {
date: '2030-11-30',
expected: 12
}, {
date: '2036-12-24',
expected: 18
}]
for (const testCase of tests) {
t.equal(
reiwa(new Date(testCase.date)),
testCase.expected,
JSON.stringify(testCase)
)
}
t.end()
})