@@ -7,49 +7,44 @@ test('mdast-util-to-string', function(t) {
7
7
t . equal ( toString ( ) , '' , 'should not fail on a missing node' )
8
8
t . equal ( toString ( null ) , '' , 'should not fail on `null` missing node' )
9
9
10
- t . equal (
11
- toString ( { value : 'foo' } ) ,
12
- 'foo' ,
13
- 'should not fail on unrecognised nodes'
14
- )
10
+ t . equal ( toString ( { value : 'foo' } ) , 'foo' , 'should not fail on nodes w/o type' )
15
11
16
12
t . equal (
17
13
toString ( {
18
14
value : 'foo' ,
19
- children : [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ]
15
+ alt : 'bar' ,
16
+ title : 'baz' ,
17
+ children : [ { value : 'qux' } ]
20
18
} ) ,
21
19
'foo' ,
22
20
'should prefer `value` over all others'
23
21
)
24
22
25
23
t . equal (
26
- toString ( { value : 'foo' , alt : 'bar' , title : 'baz' } ) ,
27
- 'foo' ,
28
- 'should prefer `value` over `alt` or `title`'
29
- )
30
-
31
- t . equal (
32
- toString ( { alt : 'bar' , title : 'baz' } ) ,
24
+ toString ( { alt : 'bar' , title : 'baz' , children : [ { value : 'qux' } ] } ) ,
33
25
'bar' ,
34
- 'should prefer `alt` over `title` '
26
+ 'should prefer `alt` over all others '
35
27
)
36
28
37
29
t . equal (
38
- toString ( {
39
- title : 'baz' ,
40
- children : [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ]
41
- } ) ,
30
+ toString ( { title : 'baz' , children : [ { value : 'qux' } ] } ) ,
42
31
'baz' ,
43
- 'should use `title` over `children` '
32
+ 'should prefer `title` over all others '
44
33
)
45
34
46
35
t . equal (
47
36
toString ( { children : [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ] } ) ,
48
37
'foobarbaz' ,
49
- 'should prefer `children`'
38
+ 'should serialize children'
39
+ )
40
+
41
+ t . equal (
42
+ toString ( [ { value : 'foo' } , { alt : 'bar' } , { title : 'baz' } ] ) ,
43
+ 'foobarbaz' ,
44
+ 'should serialize a list of nodes'
50
45
)
51
46
52
- t . equal ( toString ( { } ) , '' , 'should fall back on an empty string' )
47
+ t . equal ( toString ( { } ) , '' , 'should produce an empty string otherwise ' )
53
48
54
49
t . end ( )
55
50
} )
0 commit comments