forked from remarkjs/remark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
69 lines (63 loc) · 1.74 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import test from 'tape'
import {unified} from 'unified'
import {gfm} from 'micromark-extension-gfm'
import {gfmFromMarkdown} from 'mdast-util-gfm'
import {removePosition} from 'unist-util-remove-position'
import remarkParse from './index.js'
test('remarkParse', (t) => {
t.equal(
unified().use(remarkParse).parse('Alfred').children.length,
1,
'should accept a `string`'
)
t.test('extensions', (t) => {
const tree = unified()
.data('micromarkExtensions', [gfm()])
.data('fromMarkdownExtensions', [gfmFromMarkdown()])
.use(remarkParse)
.parse('* [x] [email protected] ~~strikethrough~~')
removePosition(tree, true)
t.deepEqual(
tree,
{
type: 'root',
children: [
{
type: 'list',
ordered: false,
start: null,
spread: false,
children: [
{
type: 'listItem',
spread: false,
checked: true,
children: [
{
type: 'paragraph',
children: [
{
type: 'link',
title: null,
url: 'mailto:[email protected]',
children: [{type: 'text', value: '[email protected]'}]
},
{type: 'text', value: ' '},
{
type: 'delete',
children: [{type: 'text', value: 'strikethrough'}]
}
]
}
]
}
]
}
]
},
'should work'
)
t.end()
})
t.end()
})