1
- import test from 'tape'
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
2
3
import { toString } from './index.js'
3
4
4
- test ( 'toString' , ( t ) => {
5
+ test ( 'toString' , ( ) => {
5
6
// @ts -expect-error: runtime.
6
- t . equal ( toString ( ) , '' , 'should not fail on a missing node' )
7
- t . equal ( toString ( null ) , '' , 'should not fail on `null` missing node' )
7
+ assert . equal ( toString ( ) , '' , 'should not fail on a missing node' )
8
+ assert . equal ( toString ( null ) , '' , 'should not fail on `null` missing node' )
8
9
9
- t . equal ( toString ( { value : 'foo' } ) , 'foo' , 'should not fail on nodes w/o type' )
10
+ assert . equal (
11
+ toString ( { value : 'foo' } ) ,
12
+ 'foo' ,
13
+ 'should not fail on nodes w/o type'
14
+ )
10
15
11
- t . equal (
16
+ assert . equal (
12
17
toString ( {
13
18
value : 'foo' ,
14
19
alt : 'bar' ,
@@ -19,37 +24,35 @@ test('toString', (t) => {
19
24
'should prefer `value` over all others'
20
25
)
21
26
22
- t . equal (
27
+ assert . equal (
23
28
toString ( { alt : 'bar' , title : 'baz' , children : [ { value : 'qux' } ] } ) ,
24
29
'bar' ,
25
30
'should prefer `alt` over all others'
26
31
)
27
32
28
- t . equal (
33
+ assert . equal (
29
34
toString ( { title : 'baz' , children : [ { value : 'qux' } ] } ) ,
30
35
'qux' ,
31
36
'should *not* prefer `title` over all others'
32
37
)
33
38
34
- t . equal (
39
+ assert . equal (
35
40
toString ( { alt : 'bar' } , { includeImageAlt : false } ) ,
36
41
'' ,
37
42
'should *not* include `alt` w/ `includeImageAlt: false`'
38
43
)
39
44
40
- t . equal (
45
+ assert . equal (
41
46
toString ( { children : [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ] } ) ,
42
47
'foobar' ,
43
48
'should serialize children'
44
49
)
45
50
46
- t . equal (
51
+ assert . equal (
47
52
toString ( [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ] ) ,
48
53
'foobar' ,
49
54
'should serialize a list of nodes'
50
55
)
51
56
52
- t . equal ( toString ( { } ) , '' , 'should produce an empty string otherwise' )
53
-
54
- t . end ( )
57
+ assert . equal ( toString ( { } ) , '' , 'should produce an empty string otherwise' )
55
58
} )
0 commit comments