1- import test from 'tape'
1+ import assert from 'node:assert/strict'
2+ import test from 'node:test'
23import { toString } from './index.js'
34
4- test ( 'toString' , ( t ) => {
5+ test ( 'toString' , ( ) => {
56 // @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' )
89
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+ )
1015
11- t . equal (
16+ assert . equal (
1217 toString ( {
1318 value : 'foo' ,
1419 alt : 'bar' ,
@@ -19,37 +24,35 @@ test('toString', (t) => {
1924 'should prefer `value` over all others'
2025 )
2126
22- t . equal (
27+ assert . equal (
2328 toString ( { alt : 'bar' , title : 'baz' , children : [ { value : 'qux' } ] } ) ,
2429 'bar' ,
2530 'should prefer `alt` over all others'
2631 )
2732
28- t . equal (
33+ assert . equal (
2934 toString ( { title : 'baz' , children : [ { value : 'qux' } ] } ) ,
3035 'qux' ,
3136 'should *not* prefer `title` over all others'
3237 )
3338
34- t . equal (
39+ assert . equal (
3540 toString ( { alt : 'bar' } , { includeImageAlt : false } ) ,
3641 '' ,
3742 'should *not* include `alt` w/ `includeImageAlt: false`'
3843 )
3944
40- t . equal (
45+ assert . equal (
4146 toString ( { children : [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ] } ) ,
4247 'foobar' ,
4348 'should serialize children'
4449 )
4550
46- t . equal (
51+ assert . equal (
4752 toString ( [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ] ) ,
4853 'foobar' ,
4954 'should serialize a list of nodes'
5055 )
5156
52- t . equal ( toString ( { } ) , '' , 'should produce an empty string otherwise' )
53-
54- t . end ( )
57+ assert . equal ( toString ( { } ) , '' , 'should produce an empty string otherwise' )
5558} )
0 commit comments