-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest.js
48 lines (42 loc) · 1.3 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
import assert from 'node:assert/strict'
import test from 'node:test'
import {emoticon} from './index.js'
test('emoticon', async function (t) {
await t.test('should expose the public api', async function () {
assert.deepEqual(Object.keys(await import('./index.js')).sort(), [
'emoticon'
])
})
await t.test('should be an array', async function () {
assert.ok(Array.isArray(emoticon))
})
await t.test('should have an `emoji` field in each entry', async function () {
for (const info of emoticon) {
assert.strictEqual(typeof info.emoji, 'string', JSON.stringify(info))
}
})
await t.test(
'should have a `description` string field in each entry',
async function () {
for (const info of emoticon) {
assert.strictEqual(
typeof info.description,
'string',
JSON.stringify(info)
)
}
}
)
await t.test('should have a `tags` array field', async function () {
for (const info of emoticon) {
assert.ok(Array.isArray(info.tags), JSON.stringify(info))
}
})
await t.test('should have an `emoticons` array field', async function () {
assert.doesNotThrow(function () {
for (const info of emoticon) {
assert.ok(Array.isArray(info.emoticons), JSON.stringify(info))
}
})
})
})