@@ -2,14 +2,11 @@ import assert from 'node:assert/strict'
2
2
import test from 'node:test'
3
3
import { h } from 'hastscript'
4
4
import { size } from './index.js'
5
- import * as mod from './index.js'
6
5
7
- test ( 'size' , ( ) => {
8
- assert . deepEqual (
9
- Object . keys ( mod ) . sort ( ) ,
10
- [ 'size' ] ,
11
- 'should expose the public api'
12
- )
6
+ test ( 'size' , async function ( t ) {
7
+ await t . test ( 'should expose the public api' , async function ( ) {
8
+ assert . deepEqual ( Object . keys ( await import ( './index.js' ) ) . sort ( ) , [ 'size' ] )
9
+ } )
13
10
14
11
const tree = h ( 'div' , [
15
12
h ( 'p' , [
@@ -22,13 +19,16 @@ test('size', () => {
22
19
h ( 'pre' , h ( 'code' , 'bar()' ) )
23
20
] )
24
21
25
- assert . equal ( size ( tree ) , 11 , 'complete tree' )
26
22
const p = tree . children [ 0 ]
27
23
assert ( p )
28
24
assert ( p . type === 'element' )
29
- assert . equal ( size ( p ) , 7 , 'parent node with mixed children' )
30
- assert . equal ( size ( p . children [ 1 ] ) , 1 , 'parent of text' )
31
- assert . equal ( size ( p . children [ 0 ] ) , 0 , 'text node' )
32
25
33
- assert . equal ( size ( tree , 'element' ) , 5 , 'test' )
26
+ await t . test ( 'should work' , async function ( ) {
27
+ assert . equal ( size ( tree ) , 11 )
28
+
29
+ assert . equal ( size ( p ) , 7 , 'parent node with mixed children' )
30
+ assert . equal ( size ( p . children [ 1 ] ) , 1 , 'parent of text' )
31
+ assert . equal ( size ( p . children [ 0 ] ) , 0 , 'text node' )
32
+ assert . equal ( size ( tree , 'element' ) , 5 , 'test' )
33
+ } )
34
34
} )
0 commit comments