forked from octokit/octokit.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarkdown-test.js
63 lines (51 loc) · 1.56 KB
/
markdown-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
const {getInstance} = require('../util')
require('../mocha-node-setup')
describe('api.github.com', () => {
let github
beforeEach(() => {
return getInstance('markdown')
.then(instance => {
github = instance
})
})
it('github.misc.renderMarkdown() & .renderMarkdownRaw()', () => {
return github.misc.renderMarkdown({
text: `### Hello
b597b5d`,
context: 'octokit-fixture-org/hello-world',
mode: 'gfm',
headers: {
accept: 'text/html'
}
})
.then((response) => {
expect(response.data).to.match(/<h3>Hello<\/h3>/)
expect(response.data).to.match(/\/octokit-fixture-org\/hello-world\/commit\/b597b5d6eead8f1a9e9d3243cd70a890a6155ca8/)
expect(response.data).to.match(/<tt>b597b5d<\/tt>/)
return github.misc.renderMarkdownRaw({
data: `### Hello
b597b5d`,
headers: {
accept: 'text/html',
'content-type': 'text/plain; charset=utf-8'
}
})
})
})
it('github.misc.renderMarkdown() with capitalized headers.Accept', () => {
return github.misc.renderMarkdown({
text: `### Hello
b597b5d`,
context: 'octokit-fixture-org/hello-world',
mode: 'gfm',
headers: {
Accept: 'text/html'
}
})
.then((response) => {
expect(response.data).to.match(/<h3>Hello<\/h3>/)
expect(response.data).to.match(/\/octokit-fixture-org\/hello-world\/commit\/b597b5d6eead8f1a9e9d3243cd70a890a6155ca8/)
expect(response.data).to.match(/<tt>b597b5d<\/tt>/)
})
})
})