Skip to content

Commit c8a1acc

Browse files
committed
test: convert fixtures to unist-builder notation
1 parent 14e2ebb commit c8a1acc

File tree

4 files changed

+227
-513
lines changed

4 files changed

+227
-513
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"nth-check": "^1.0.1"
4646
},
4747
"devDependencies": {
48-
"tape": "^4.2.0"
48+
"tape": "^4.2.0",
49+
"unist-builder": "^1.0.1"
4950
}
5051
}

test/lib/ast.js

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
'use strict';
2+
3+
var u = require('unist-builder');
4+
5+
6+
module.exports = function () {
7+
return u('root', [
8+
u('heading', { depth: 1 }, [
9+
u('text', 'Risus pretium quam!')
10+
]),
11+
u('heading', { depth: 2 }, [
12+
u('text', 'Vitae')
13+
]),
14+
u('blockquote', [
15+
u('paragraph', [
16+
u('text', 'Dignissim '),
17+
u('emphasis', [
18+
u('text', 'cras')
19+
]),
20+
u('text', ' tincidunt lobortis feugiat vivamus at augue eget arcu.')
21+
])
22+
]),
23+
u('paragraph', [
24+
u('text', 'At '),
25+
u('emphasis', [
26+
u('text', 'risus '),
27+
u('linkReference', {
28+
identifier: 'viverra',
29+
referenceType: 'shortcut'
30+
}, [
31+
u('text', 'viverra')
32+
])
33+
]),
34+
u('text', ':')
35+
]),
36+
u('list', {
37+
ordered: false,
38+
start: null,
39+
loose: false
40+
}, [
41+
u('listItem', {
42+
loose: false,
43+
checked: null
44+
}, [
45+
u('paragraph', [
46+
u('text', 'adipiscing at in tellus '),
47+
u('inlineCode', 'integer'),
48+
u('text', ';')
49+
])
50+
]),
51+
u('listItem', {
52+
loose: false,
53+
checked: null
54+
}, [
55+
u('paragraph', [
56+
u('text', 'feugiat scelerisque varius morbi;')
57+
]),
58+
u('list', {
59+
ordered: false,
60+
start: null,
61+
loose: false
62+
}, [
63+
u('listItem', {
64+
loose: false,
65+
checked: null
66+
}, [
67+
u('paragraph', [
68+
u('text', 'enim nunc?')
69+
]),
70+
u('list', {
71+
ordered: false,
72+
start: null,
73+
loose: false
74+
}, [
75+
u('listItem', {
76+
loose: false,
77+
checked: null
78+
}, [
79+
u('paragraph', [
80+
u('text', 'yeah, whatever')
81+
])
82+
])
83+
])
84+
]),
85+
u('listItem', {
86+
loose: false,
87+
checked: null
88+
}, [
89+
u('paragraph', [
90+
u('strong', [
91+
u('text', 'Diam '),
92+
u('emphasis', [
93+
u('text', 'ut')
94+
]),
95+
u('text', ' venenatis!')
96+
])
97+
])
98+
])
99+
])
100+
])
101+
]),
102+
u('paragraph', [
103+
u('text', 'Tellus in metus:')
104+
]),
105+
u('list', {
106+
ordered: true,
107+
start: 1,
108+
loose: false
109+
}, [
110+
u('listItem', {
111+
loose: false,
112+
checked: null
113+
}, [
114+
u('paragraph', [
115+
u('text', 'Vulputate eu scelerisque.')
116+
])
117+
]),
118+
u('listItem', {
119+
loose: false,
120+
checked: null
121+
}, [
122+
u('paragraph', [
123+
u('text', 'Felis imperdiet '),
124+
u('inlineCode', 'proin'),
125+
u('text', ', fermentum leo vel orci.')
126+
])
127+
])
128+
]),
129+
u('heading', { depth: 3 }, [
130+
u('text', 'Et pharetra '),
131+
u('linkReference', {
132+
identifier: 'pharetra massa',
133+
referenceType: 'shortcut'
134+
}, [
135+
u('text', 'pharetra massa')
136+
])
137+
]),
138+
u('paragraph', [
139+
u('image', {
140+
title: null,
141+
src: 'http://i.imgur.com/Zp0YZTA.gif',
142+
alt: 'funny gif'
143+
})
144+
]),
145+
u('code', { lang: 'js' },
146+
'const truth = [...Array(15).keys()].reduce((x, y) => x + y);'),
147+
u('table', { align: ['center', 'left', null] }, [
148+
u('tableHeader', [
149+
u('tableCell', [
150+
u('text', 'massa')
151+
]),
152+
u('tableCell', [
153+
u('text', 'ultricies')
154+
]),
155+
u('tableCell', [
156+
u('text', 'mi')
157+
])
158+
]),
159+
u('tableRow', [
160+
u('tableCell', [
161+
u('text', 'quis hendrerit')
162+
]),
163+
u('tableCell', [
164+
u('inlineCode', 'sin'),
165+
u('text', ', '),
166+
u('inlineCode', 'cos'),
167+
u('text', ', '),
168+
u('inlineCode', 'tan')
169+
]),
170+
u('tableCell', [
171+
u('text', 'dolor')
172+
])
173+
]),
174+
u('tableRow', [
175+
u('tableCell', [
176+
u('text', 'magna eget est')
177+
]),
178+
u('tableCell', [
179+
u('text', 'lorem ipsum!')
180+
]),
181+
u('tableCell', [
182+
u('text', '15000')
183+
])
184+
])
185+
]),
186+
u('paragraph', [
187+
u('text', 'Consequat '),
188+
u('linkReference', {
189+
identifier: 'interdum',
190+
referenceType: 'shortcut'
191+
}, [
192+
u('text', 'interdum')
193+
]),
194+
u('text', ' varius sit amet, mattis vulputate enim nulla aliquet porttitor lacus, luctus accumsan tortor?..')
195+
]),
196+
u('heading', { depth: 2 }, [
197+
u('text', 'References')
198+
]),
199+
u('definition', {
200+
identifier: 'viverra',
201+
title: null,
202+
link: 'http://lmgtfy.com/?q=viverra'
203+
}),
204+
u('definition', {
205+
identifier: 'pharetra mass',
206+
title: null,
207+
link: 'http://lmgtfy.com/?q=pharetra+mass'
208+
}),
209+
u('definition', {
210+
identifier: 'interdum',
211+
title: null,
212+
link: 'http://lmgtfy.com/?q=interdum'
213+
}),
214+
u('heading', { depth: 2 }, [
215+
u('text', 'License')
216+
]),
217+
u('paragraph', [
218+
u('text', 'MIT')
219+
]),
220+
u('div', [
221+
u('div', [])
222+
])
223+
]);
224+
};

0 commit comments

Comments
 (0)