-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
85 lines (74 loc) · 2.11 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import assert from 'node:assert/strict'
import test from 'node:test'
import {udhr} from './index.js'
test('udhr', function () {
assert.equal(typeof udhr, 'object', 'should be an object')
})
test('udhr[]', function () {
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert.strictEqual(typeof udhr[index], 'object')
}
}, 'should be an object')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert.strictEqual(typeof udhr[index].iso6393, 'string')
}
}, 'should have an iso')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert.strictEqual(typeof udhr[index].bcp47, 'string')
}
}, 'should have a bcp')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert(
typeof udhr[index].ohchr === 'string' || udhr[index].ohchr === null
)
}
}, 'should have an ohchr')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert.strictEqual(typeof udhr[index].code, 'string')
}
}, 'should have a code')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert.strictEqual(typeof udhr[index].name, 'string')
}
}, 'should have a name')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
const stage = udhr[index].stage
assert(typeof stage === 'number')
assert(Math.round(stage) === stage)
assert(stage > 0)
assert(stage < 6)
}
}, 'should have a stage')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert(
typeof udhr[index].latitude === 'number' ||
udhr[index].latitude === null
)
}
}, 'should have a `latitude`')
assert.doesNotThrow(function () {
let index = -1
while (++index < udhr.length) {
assert(
typeof udhr[index].longitude === 'number' ||
udhr[index].longitude === null
)
}
}, 'should have a `longitude`')
})