-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
89 lines (64 loc) · 1.77 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { equal } from 'assert';
import expect from 'expect';
import getContent from './index';
const basic_italicized_date = `
# header
_20 June 2016_
#tag1 #tag2 #tag3;
content
with two paragraphs`
const basic_italicized_date2 = `
# header
_June 21, 2016_
content
with two paragraphs`
const content_with_header_and_img = `
# header
20 June 2016

content1
content2
## header2`;
const table = `
|header1|header2|
|-------|-------|
| col1 | col2 |`;
const strikethrough = `
~~text~~`;
it('should getContent(basic_italicized_date) html without header and date', () =>
equal(getContent(basic_italicized_date).html,
`<p>content</p>
<p>with two paragraphs</p>`
));
it('should getContent(basic_italicized_date) plain text ', () =>
equal(getContent(basic_italicized_date).text,
`content
with two paragraphs`
));
it('should getContent(basic_italicized_date) html without header and date', () =>
equal(getContent(basic_italicized_date2).html,
`<p>content</p>
<p>with two paragraphs</p>`
));
it('should getContent(basic_italicized_date) plain text ', () =>
equal(getContent(basic_italicized_date2).text,
`content
with two paragraphs`
));
it('should getContent(content_with_header_and_img) html with img and h2', () =>
equal(getContent(content_with_header_and_img).html,
`<p><img src="http://yo.io/" alt="alt"></p>
<p>content1</p>
<p>content2</p>
<h2>header2</h2>`
));
it('should getContent(content_with_header_and_img) plain text', () =>
equal(getContent(content_with_header_and_img).text,
`content1
content2
header2`
));
it('should getContent(table) with <table> html tag', () =>
expect(getContent(table).html).toMatch(/<table>/));
it('should getContent(strikethrough) with <del> html tag', () =>
expect(getContent(strikethrough).html).toMatch(/<del>/));