@@ -3,55 +3,57 @@ import test from 'node:test'
3
3
import { fromMarkdown } from 'mdast-util-from-markdown'
4
4
import { u } from 'unist-builder'
5
5
import { removePosition } from './index.js'
6
- import * as mod from './index.js'
7
6
8
- test ( 'removePosition' , ( ) => {
9
- assert . deepEqual (
10
- Object . keys ( mod ) . sort ( ) ,
11
- [ 'removePosition' ] ,
12
- 'should expose the public api'
13
- )
7
+ test ( 'removePosition' , async function ( t ) {
8
+ await t . test ( 'should expose the public api' , async function ( ) {
9
+ assert . deepEqual ( Object . keys ( await import ( './index.js' ) ) . sort ( ) , [
10
+ 'removePosition'
11
+ ] )
12
+ } )
14
13
15
- const empty = { position : undefined }
14
+ await t . test ( 'should work softly' , async function ( ) {
15
+ const empty = { position : undefined }
16
16
17
- assert . deepEqual (
18
- removePosition ( fromMarkdown ( 'Some **strong**, _emphasis_, and `code`.' ) ) ,
19
- u ( 'root' , empty , [
20
- u ( 'paragraph' , empty , [
21
- u ( 'text' , empty , 'Some ' ) ,
22
- u ( 'strong' , empty , [ u ( 'text' , empty , 'strong' ) ] ) ,
23
- u ( 'text' , empty , ', ' ) ,
24
- u ( 'emphasis' , empty , [ u ( 'text' , empty , 'emphasis' ) ] ) ,
25
- u ( 'text' , empty , ', and ' ) ,
26
- u ( 'inlineCode' , empty , 'code' ) ,
27
- u ( 'text' , empty , '.' )
17
+ assert . deepEqual (
18
+ removePosition ( fromMarkdown ( 'Some **strong**, _emphasis_, and `code`.' ) ) ,
19
+ u ( 'root' , empty , [
20
+ u ( 'paragraph' , empty , [
21
+ u ( 'text' , empty , 'Some ' ) ,
22
+ u ( 'strong' , empty , [ u ( 'text' , empty , 'strong' ) ] ) ,
23
+ u ( 'text' , empty , ', ' ) ,
24
+ u ( 'emphasis' , empty , [ u ( 'text' , empty , 'emphasis' ) ] ) ,
25
+ u ( 'text' , empty , ', and ' ) ,
26
+ u ( 'inlineCode' , empty , 'code' ) ,
27
+ u ( 'text' , empty , '.' )
28
+ ] )
28
29
] )
29
- ] ) ,
30
- 'should work softly'
31
- )
30
+ )
31
+ } )
32
32
33
- assert . deepEqual (
34
- removePosition (
35
- fromMarkdown ( 'Some **strong**, _emphasis_, and `code`.' ) ,
36
- true
37
- ) ,
38
- u ( 'root' , [
39
- u ( 'paragraph' , [
40
- u ( 'text' , 'Some ' ) ,
41
- u ( 'strong' , [ u ( 'text' , 'strong' ) ] ) ,
42
- u ( 'text' , ', ' ) ,
43
- u ( 'emphasis' , [ u ( 'text' , 'emphasis' ) ] ) ,
44
- u ( 'text' , ', and ' ) ,
45
- u ( 'inlineCode' , 'code' ) ,
46
- u ( 'text' , '.' )
33
+ await t . test ( 'should work by force' , async function ( ) {
34
+ assert . deepEqual (
35
+ removePosition (
36
+ fromMarkdown ( 'Some **strong**, _emphasis_, and `code`.' ) ,
37
+ true
38
+ ) ,
39
+ u ( 'root' , [
40
+ u ( 'paragraph' , [
41
+ u ( 'text' , 'Some ' ) ,
42
+ u ( 'strong' , [ u ( 'text' , 'strong' ) ] ) ,
43
+ u ( 'text' , ', ' ) ,
44
+ u ( 'emphasis' , [ u ( 'text' , 'emphasis' ) ] ) ,
45
+ u ( 'text' , ', and ' ) ,
46
+ u ( 'inlineCode' , 'code' ) ,
47
+ u ( 'text' , '.' )
48
+ ] )
47
49
] )
48
- ] ) ,
49
- 'should work by force'
50
- )
50
+ )
51
+ } )
51
52
52
- assert . deepEqual (
53
- removePosition ( fromMarkdown ( 'x' ) , { force : true } ) ,
54
- u ( 'root' , [ u ( 'paragraph' , [ u ( 'text' , 'x' ) ] ) ] ) ,
55
- 'should support options'
56
- )
53
+ await t . test ( 'should support options' , async function ( ) {
54
+ assert . deepEqual (
55
+ removePosition ( fromMarkdown ( 'x' ) , { force : true } ) ,
56
+ u ( 'root' , [ u ( 'paragraph' , [ u ( 'text' , 'x' ) ] ) ] )
57
+ )
58
+ } )
57
59
} )
0 commit comments