@@ -2,33 +2,28 @@ import assert from 'node:assert/strict'
2
2
import test from 'node:test'
3
3
import { h } from 'hastscript'
4
4
import { headingRank } from './index.js'
5
- import * as mod from './index.js'
6
5
7
- test ( 'headingRank' , ( ) => {
8
- assert . deepEqual (
9
- Object . keys ( mod ) . sort ( ) ,
10
- [ 'headingRank' ] ,
11
- 'should expose the public api'
12
- )
6
+ test ( 'headingRank' , async function ( t ) {
7
+ await t . test ( 'should expose the public api' , async function ( ) {
8
+ assert . deepEqual ( Object . keys ( await import ( './index.js' ) ) . sort ( ) , [
9
+ 'headingRank'
10
+ ] )
11
+ } )
13
12
14
- // @ts -expect-error runtime.
15
- assert . equal ( headingRank ( ) , null , 'should return null for non-nodes' )
13
+ await t . test ( 'should return null for non-nodes' , async function ( ) {
14
+ // @ts -expect-error runtime.
15
+ assert . equal ( headingRank ( ) , null )
16
+ } )
16
17
17
- assert . equal (
18
- headingRank ( { type : 'text' , value : '!' } ) ,
19
- null ,
20
- 'should return null for non-elements'
21
- )
18
+ await t . test ( 'should return null for non-elements' , async function ( ) {
19
+ assert . equal ( headingRank ( { type : 'text' , value : '!' } ) , null )
20
+ } )
22
21
23
- assert . equal (
24
- headingRank ( h ( 'p' , '!' ) ) ,
25
- null ,
26
- 'should return null for non-headings'
27
- )
22
+ await t . test ( 'should return null for non-headings' , async function ( ) {
23
+ assert . equal ( headingRank ( h ( 'p' , '!' ) ) , null )
24
+ } )
28
25
29
- assert . equal (
30
- headingRank ( h ( 'h5' , '!' ) ) ,
31
- 5 ,
32
- 'should return the rank of a heading'
33
- )
26
+ await t . test ( 'should return the rank of a heading' , async function ( ) {
27
+ assert . equal ( headingRank ( h ( 'h5' , '!' ) ) , 5 )
28
+ } )
34
29
} )
0 commit comments