|
1 | 1 | import assert from 'node:assert/strict'
|
2 | 2 | import test from 'node:test'
|
3 | 3 | import {whitespace} from './index.js'
|
4 |
| -import * as mod from './index.js' |
5 | 4 |
|
6 |
| -test('whitespace', () => { |
7 |
| - assert.deepEqual( |
8 |
| - Object.keys(mod).sort(), |
9 |
| - ['whitespace'], |
10 |
| - 'should expose the public api' |
11 |
| - ) |
| 5 | +test('whitespace', async function (t) { |
| 6 | + await t.test('should expose the public api', async function () { |
| 7 | + assert.deepEqual(Object.keys(await import('./index.js')).sort(), [ |
| 8 | + 'whitespace' |
| 9 | + ]) |
| 10 | + }) |
12 | 11 |
|
13 |
| - assert.equal( |
14 |
| - whitespace({type: 'comment', value: 'asd'}), |
15 |
| - false, |
16 |
| - 'should return `false` without text' |
17 |
| - ) |
| 12 | + await t.test('should return `false` without text', async function () { |
| 13 | + assert.equal(whitespace({type: 'comment', value: 'asd'}), false) |
| 14 | + }) |
18 | 15 |
|
19 |
| - assert.equal( |
20 |
| - whitespace({type: 'text', value: '\v'}), |
21 |
| - false, |
22 |
| - 'should return `false` for other white-space' |
| 16 | + await t.test( |
| 17 | + 'should return `false` for other white-space', |
| 18 | + async function () { |
| 19 | + assert.equal(whitespace({type: 'text', value: '\v'}), false) |
| 20 | + } |
23 | 21 | )
|
24 | 22 |
|
25 |
| - assert.equal( |
26 |
| - whitespace({type: 'text', value: ' \t\r\n\f'}), |
27 |
| - true, |
28 |
| - 'should return `true` for inter-element white-space' |
| 23 | + await t.test( |
| 24 | + 'should return `true` for inter-element white-space', |
| 25 | + async function () { |
| 26 | + assert.equal(whitespace({type: 'text', value: ' \t\r\n\f'}), true) |
| 27 | + } |
29 | 28 | )
|
30 | 29 |
|
31 |
| - assert.equal( |
32 |
| - whitespace(' \v'), |
33 |
| - false, |
34 |
| - 'should return `false` for a `string` of text' |
| 30 | + await t.test( |
| 31 | + 'should return `false` for a `string` of text', |
| 32 | + async function () { |
| 33 | + assert.equal(whitespace(' \v'), false) |
| 34 | + } |
35 | 35 | )
|
36 | 36 |
|
37 |
| - assert.equal( |
38 |
| - whitespace(' \t\r\n\f'), |
39 |
| - true, |
40 |
| - 'should return `true` for a `string` of inter-element white-space' |
| 37 | + await t.test( |
| 38 | + 'should return `true` for a `string` of inter-element white-space', |
| 39 | + async function () { |
| 40 | + assert.equal(whitespace(' \t\r\n\f'), true) |
| 41 | + } |
41 | 42 | )
|
42 | 43 | })
|
0 commit comments