-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
51 lines (36 loc) · 841 Bytes
/
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
const test = require('tape');
const stripMarkdownOneline = require('./index');
test('it strips markdown syntax', (t) => {
t.plan(1);
const input = `
# Title
> blockquote
## Header 2
This is a link: [search engine](https://duckduckgo.com)
`;
const output = stripMarkdownOneline(input);
t.equal(output, 'Title blockquote Header 2 This is a link: search engine');
});
test('handles trailing spaces', (t) => {
t.plan(1);
const input =
`
# Title
First: primeiro` +
' ' +
`
Second: segundo
`;
const output = stripMarkdownOneline(input);
t.equal(output, 'Title First: primeiro Second: segundo');
});
test('ignore html', (t) => {
t.plan(1);
const input = `
# Title
<p>First: primeiro</p>
Second: segundo
`;
const output = stripMarkdownOneline(input);
t.equal(output, 'Title Second: segundo');
});