|
1 | 1 | import assert from 'node:assert/strict'
|
2 | 2 | import test from 'node:test'
|
3 | 3 | import {scriptSupporting} from './index.js'
|
4 |
| -import * as mod from './index.js' |
5 | 4 |
|
6 |
| -test('scriptSupporting', () => { |
7 |
| - assert.deepEqual( |
8 |
| - Object.keys(mod).sort(), |
9 |
| - ['scriptSupporting'], |
10 |
| - 'should expose the public api' |
11 |
| - ) |
| 5 | +test('scriptSupporting', 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 | + 'scriptSupporting' |
| 9 | + ]) |
| 10 | + }) |
12 | 11 |
|
13 |
| - assert.equal(scriptSupporting(), false, 'should return `false` without node') |
| 12 | + await t.test('should return `false` without node', async function () { |
| 13 | + // @ts-expect-error `node` should be given. |
| 14 | + assert.equal(scriptSupporting(), false) |
| 15 | + }) |
14 | 16 |
|
15 |
| - assert.equal( |
16 |
| - scriptSupporting(null), |
17 |
| - false, |
18 |
| - 'should return `false` with `null`' |
19 |
| - ) |
| 17 | + await t.test('should return `false` with `null`', async function () { |
| 18 | + assert.equal(scriptSupporting(null), false) |
| 19 | + }) |
20 | 20 |
|
21 |
| - assert.equal( |
22 |
| - scriptSupporting({type: 'text'}), |
23 |
| - false, |
24 |
| - 'should return `false` when without `element`' |
| 21 | + await t.test( |
| 22 | + 'should return `false` when without `element`', |
| 23 | + async function () { |
| 24 | + assert.equal(scriptSupporting({type: 'text'}), false) |
| 25 | + } |
25 | 26 | )
|
26 | 27 |
|
27 |
| - assert.equal( |
28 |
| - scriptSupporting({type: 'element'}), |
29 |
| - false, |
30 |
| - 'should return `false` when with invalid `element`' |
| 28 | + await t.test( |
| 29 | + 'should return `false` when with invalid `element`', |
| 30 | + async function () { |
| 31 | + assert.equal(scriptSupporting({type: 'element'}), false) |
| 32 | + } |
31 | 33 | )
|
32 | 34 |
|
33 |
| - assert.equal( |
34 |
| - scriptSupporting({ |
35 |
| - type: 'element', |
36 |
| - tagName: 'a', |
37 |
| - properties: {href: '#alpha', title: 'Bravo'}, |
38 |
| - children: [{type: 'text', value: 'Charlie'}] |
39 |
| - }), |
40 |
| - false, |
41 |
| - 'should return `false` when without not script-supporting' |
| 35 | + await t.test( |
| 36 | + 'should return `false` when without not script-supporting', |
| 37 | + async function () { |
| 38 | + assert.equal( |
| 39 | + scriptSupporting({ |
| 40 | + type: 'element', |
| 41 | + tagName: 'a', |
| 42 | + properties: {href: '#alpha', title: 'Bravo'}, |
| 43 | + children: [{type: 'text', value: 'Charlie'}] |
| 44 | + }), |
| 45 | + false |
| 46 | + ) |
| 47 | + } |
42 | 48 | )
|
43 | 49 |
|
44 |
| - assert.equal( |
45 |
| - scriptSupporting({ |
46 |
| - type: 'element', |
47 |
| - tagName: 'template', |
48 |
| - children: [{type: 'text', value: 'Delta'}] |
49 |
| - }), |
50 |
| - true, |
51 |
| - 'should return `true` when with script-supporting' |
| 50 | + await t.test( |
| 51 | + 'should return `true` when with script-supporting', |
| 52 | + async function () { |
| 53 | + assert.equal( |
| 54 | + scriptSupporting({ |
| 55 | + type: 'element', |
| 56 | + tagName: 'template', |
| 57 | + children: [{type: 'text', value: 'Delta'}] |
| 58 | + }), |
| 59 | + true |
| 60 | + ) |
| 61 | + } |
52 | 62 | )
|
53 | 63 | })
|
0 commit comments