generated from actions/typescript-action
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathreopen.test.ts
42 lines (32 loc) · 1.01 KB
/
reopen.test.ts
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
import nock from 'nock'
import * as utils from '../testUtils'
import {handleIssueComment} from '../../src/issueComment/handleIssueComment'
import issueCommentEvent from '../fixtures/issues/issueCommentEvent.json'
describe('/reopen', () => {
beforeEach(() => {
utils.setupActionsEnv('/reopen')
})
it('reopens the issue with /reopen', async () => {
issueCommentEvent.comment.body = '/reopen much better title'
nock(utils.api)
.get('/repos/Codertocat/Hello-World/collaborators/Codertocat')
.reply(204)
nock(utils.api)
.patch('/repos/Codertocat/Hello-World/issues/1', body => {
expect(body).toMatchObject({
state: "open"
})
return true
})
.reply(200)
const commentContext = new utils.mockContext(issueCommentEvent)
await handleIssueComment(commentContext)
expect(nock.isDone()).toBe(true)
expect.assertions(2)
})
describe('error', () => {
xit('reply with error message cannot open', () => {
// TODO
})
})
})