@@ -26,42 +26,42 @@ test('source', async function (t) {
26
26
assert ( text . type === 'text' )
27
27
28
28
await t . test ( 'should support a root' , async function ( ) {
29
- assert . equal ( source ( tree , file ) , '> + **[Hello](./example)**\n> world.' )
29
+ assert . equal ( source ( file , tree ) , '> + **[Hello](./example)**\n> world.' )
30
30
} )
31
31
32
32
await t . test ( 'should support a block quote' , async function ( ) {
33
33
assert . equal (
34
- source ( blockquote , file ) ,
34
+ source ( file , blockquote ) ,
35
35
'> + **[Hello](./example)**\n> world.'
36
36
)
37
37
} )
38
38
39
39
await t . test ( 'should support a list' , async function ( ) {
40
- assert . equal ( source ( list , file ) , '+ **[Hello](./example)**\n> world.' )
40
+ assert . equal ( source ( file , list ) , '+ **[Hello](./example)**\n> world.' )
41
41
} )
42
42
43
43
await t . test ( 'should support a list item' , async function ( ) {
44
- assert . equal ( source ( listItem , file ) , '+ **[Hello](./example)**\n> world.' )
44
+ assert . equal ( source ( file , listItem ) , '+ **[Hello](./example)**\n> world.' )
45
45
} )
46
46
47
47
await t . test ( 'should support a paragraph' , async function ( ) {
48
- assert . equal ( source ( paragraph , file ) , '**[Hello](./example)**\n> world.' )
48
+ assert . equal ( source ( file , paragraph ) , '**[Hello](./example)**\n> world.' )
49
49
} )
50
50
51
51
await t . test ( 'should support strong' , async function ( ) {
52
- assert . equal ( source ( strong , file ) , '**[Hello](./example)**' )
52
+ assert . equal ( source ( file , strong ) , '**[Hello](./example)**' )
53
53
} )
54
54
55
55
await t . test ( 'should support a link' , async function ( ) {
56
- assert . equal ( source ( link , file ) , '[Hello](./example)' )
56
+ assert . equal ( source ( file , link ) , '[Hello](./example)' )
57
57
} )
58
58
59
59
await t . test ( 'should support a text' , async function ( ) {
60
- assert . equal ( source ( text , file ) , 'Hello' )
60
+ assert . equal ( source ( file , text ) , 'Hello' )
61
61
} )
62
62
63
63
await t . test ( 'should support a position' , async function ( ) {
64
- assert . equal ( source ( text . position , file ) , 'Hello' )
64
+ assert . equal ( source ( file , text . position ) , 'Hello' )
65
65
} )
66
66
67
67
await t . test ( 'should support out of bounds data' , async function ( ) {
@@ -70,44 +70,44 @@ test('source', async function (t) {
70
70
value : 'qwe' ,
71
71
position : { start : { line : 0 , column : 0 } , end : { line : 0 , column : 0 } }
72
72
}
73
- assert . equal ( source ( text , file ) , undefined )
73
+ assert . equal ( source ( file , text ) , undefined )
74
74
} )
75
75
76
76
await t . test ( 'should support a generated node' , async function ( ) {
77
77
const text = { type : 'text' , value : 'qwe' }
78
- assert . equal ( source ( text , file ) , undefined )
78
+ assert . equal ( source ( file , text ) , undefined )
79
79
} )
80
80
81
81
await t . test ( 'should support a nullish node' , async function ( ) {
82
- assert . equal ( source ( null , file ) , undefined )
82
+ assert . equal ( source ( file , null ) , undefined )
83
83
} )
84
84
85
85
await t . test ( 'should support cr + lf' , async function ( ) {
86
86
const file = new VFile ( 'a\r\nb' )
87
87
const node = fromMarkdown ( String ( file ) )
88
88
const paragraph = node . children [ 0 ]
89
- assert . equal ( source ( paragraph , file ) , 'a\r\nb' )
89
+ assert . equal ( source ( file , paragraph ) , 'a\r\nb' )
90
90
} )
91
91
92
92
await t . test ( 'should support cr' , async function ( ) {
93
93
const file = new VFile ( 'a\rb' )
94
94
const node = fromMarkdown ( String ( file ) )
95
95
const paragraph = node . children [ 0 ]
96
96
97
- assert . equal ( source ( paragraph , file ) , 'a\rb' )
97
+ assert . equal ( source ( file , paragraph ) , 'a\rb' )
98
98
} )
99
99
100
100
await t . test ( 'should support an eof eol' , async function ( ) {
101
101
const file = new VFile ( 'a\n' )
102
102
const node = fromMarkdown ( String ( file ) )
103
103
104
- assert . equal ( source ( node , file ) , 'a\n' )
104
+ assert . equal ( source ( file , node ) , 'a\n' )
105
105
} )
106
106
107
107
await t . test ( 'should support an lf + cr (a blank line)' , async function ( ) {
108
108
const file = new VFile ( 'a\n\rb' )
109
109
const node = fromMarkdown ( String ( file ) )
110
110
111
- assert . equal ( source ( node , file ) , 'a\n\rb' )
111
+ assert . equal ( source ( file , node ) , 'a\n\rb' )
112
112
} )
113
113
} )
0 commit comments