-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
40 lines (34 loc) · 1.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
import assert from 'node:assert/strict'
import test from 'node:test'
import {whitespace} from 'hast-util-whitespace'
test('whitespace', async function (t) {
await t.test('should expose the public api', async function () {
assert.deepEqual(Object.keys(await import('hast-util-whitespace')).sort(), [
'whitespace'
])
})
await t.test('should return `false` without text', async function () {
assert.equal(whitespace({type: 'comment', value: 'asd'}), false)
})
await t.test('should return `false` for other whitespace', async function () {
assert.equal(whitespace({type: 'text', value: '\v'}), false)
})
await t.test(
'should return `true` for inter-element whitespace',
async function () {
assert.equal(whitespace({type: 'text', value: ' \t\r\n\f'}), true)
}
)
await t.test(
'should return `false` for a `string` of text',
async function () {
assert.equal(whitespace(' \v'), false)
}
)
await t.test(
'should return `true` for a `string` of inter-element whitespace',
async function () {
assert.equal(whitespace(' \t\r\n\f'), true)
}
)
})