blob: 5d4c995136a446defd89b418254eed23bbe4f724 (
plain)
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
|
import test from 'ava';
import unified from 'unified';
import raw from 'rehype-raw';
import reParse from 'remark-parse';
import stringify from 'rehype-stringify';
import remark2rehype from 'remark-rehype';
import plugin from '../app';
const render = text => unified()
.use(reParse)
.use(plugin)
.use(remark2rehype)
.use(stringify)
.processSync(text);
const renderRaw = text => unified()
.use(reParse)
.use(plugin)
.use(remark2rehype, {allowDangerousHTML: true})
.use(raw)
.use(stringify)
.processSync(text);
test('simple citation', t => {
const {contents} = render('>This is a citation');
t.is(contents, '<blockquote>\n<p>This is a citation</p>\n</blockquote>');
});
test('simple citation raw', t => {
const {contents} = renderRaw('>This is a citation');
t.is(contents, '<blockquote>\n<p>This is a citation</p>\n</blockquote>');
});
test('question', t => {
const {contents} = renderRaw('>!question\nWhat does the 🦊 say ?');
t.snapshot(contents);
});
|