forked from octokit/octokit.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-status-test.js
65 lines (55 loc) · 1.65 KB
/
create-status-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
const {getInstance} = require('../util')
require('../mocha-node-setup')
describe('api.github.com', () => {
let github
beforeEach(() => {
return getInstance('create-status')
.then(instance => {
github = instance
github.authenticate({
type: 'token',
token: '0000000000000000000000000000000000000001'
})
})
})
it('github.repos.createStatus()', () => {
return Promise.all([
github.repos.createStatus({
owner: 'octokit-fixture-org',
repo: 'create-status',
sha: '0000000000000000000000000000000000000001',
state: 'failure',
target_url: 'https://example.com',
description: 'create-status failure test',
context: 'example/1'
}),
github.repos.createStatus({
owner: 'octokit-fixture-org',
repo: 'create-status',
sha: '0000000000000000000000000000000000000001',
state: 'success',
target_url: 'https://example.com',
description: 'create-status success test',
context: 'example/2'
})
])
.then(() => {
return github.repos.getStatuses({
owner: 'octokit-fixture-org',
repo: 'create-status',
ref: '0000000000000000000000000000000000000001'
})
})
.then((response) => {
expect(response.data.length).to.equal(2)
return github.repos.getCombinedStatusForRef({
owner: 'octokit-fixture-org',
repo: 'create-status',
ref: '0000000000000000000000000000000000000001'
})
})
.then((response) => {
expect(response.data.state).to.equal('failure')
})
})
})