-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
69 lines (51 loc) · 1.64 KB
/
Copy pathtest.js
File metadata and controls
69 lines (51 loc) · 1.64 KB
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 'ava'
import rehypeStringify from 'rehype-stringify'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {unified} from 'unified'
import rehypeQuotebacks from './src/index.js'
const process = async markdown =>
String(
await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeQuotebacks)
.use(rehypeStringify).process(markdown),
)
// Tests
test('Processes one line quotes in isolation', async t => {
const markdown = `> Here's something smart I wrote so you can quote.
Source: [My Blog](https://example.org/blog) by Anonymous Author
`
t.snapshot(await process(markdown))
})
test('Processes multiline quotes in isolation', async t => {
const markdown = `> Here's something smart I wrote so you can quote:
>
> Words flow with great ease,
> Thoughts become wisdom in ink,
> Smartness on the page.
Source: [My Blog](https://example.org/blog) by Anonymous Author
`
t.snapshot(await process(markdown))
})
test('Processes one line quotes in context', async t => {
const markdown = `# How to quoteback?
> Here's something smart I wrote so you can quote.
Source: [My Blog](https://example.org/blog) by Anonymous Author
And this is how you quoteback.
`
t.snapshot(await process(markdown))
})
test('Processes multiline quotes in context', async t => {
const markdown = `# How to quoteback?
> Here's something smart I wrote so you can quote:
>
> Words flow with great ease,
> Thoughts become wisdom in ink,
> Smartness on the page.
Source: [My Blog](https://example.org/blog) by Anonymous Author
And this is how you quoteback.
`
t.snapshot(await process(markdown))
})