Repository navigation
Expand file tree
/
Copy pathsetup.js
More file actions
80 lines (78 loc) · 1.81 KB
/
Copy pathsetup.js
File metadata and controls
80 lines (78 loc) · 1.81 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
70
71
72
73
74
75
76
77
78
79
80
import moxios from 'moxios'
// mock window.*
global.localStorage = {
getItem () { return '{}' },
setItem () {},
removeItem () {}
}
global.document = {
title: ''
}
global.location = {
search: '',
href: ''
}
// mock axios request
moxios.stubRequest(/\/repos\/.*\/comments/, {
status: 200,
response: [{
id: 1,
html_url: 'https://github.com/xxx/xxx/issues/1#issuecomment-xxx',
body_html: '<p>111</p>',
created_at: '2017-06-30T09:00:19Z',
user: {
login: 'booxood',
avatar_url: 'https://avatars0.githubusercontent.com/u/2151410?v=3',
html_url: 'https://github.com/booxood'
}
}, {
id: 2,
html_url: 'https://github.com/xxx/xxx/issues/1#issuecomment-xxx',
body_html: '<p>222</p>',
created_at: '2017-06-30T09:01:19Z',
user: {
login: 'booxood',
avatar_url: 'https://avatars0.githubusercontent.com/u/2151410?v=3',
html_url: 'https://github.com/booxood'
}
}]
})
moxios.stubRequest(/\/repos\/.*\/issues/, {
status: 200,
response: [{
html_url: 'https://github.com/xxx/xxx/issues/1',
comments_url: 'https://api.github.com/repos/xxx/xxx/issues/1/comments',
comments: 2
}]
})
moxios.stubRequest(/\/graphql/, {
status: 200,
response: {
data: {
repository: {
issue: {
comments: {
nodes: [{
databaseId: 1,
author: {},
bodyHTML: '<p>111</p>',
body: '111',
createdAt: '2017-06-30T09:00:19Z',
}, {
databaseId: 2,
author: {},
bodyHTML: '<p>222</p>',
body: '222',
createdAt: '2017-06-30T09:01:19ZZ',
}],
pageInfo: {},
totalCount: 2
},
}
}
}
}
})
moxios.stubRequest(/.*/, {
status: 404,
})