Skip to content

Commit

Permalink
test: no configuration should not schedule a pull request and not thr…
Browse files Browse the repository at this point in the history
…ow errors
  • Loading branch information
bobvanderlinden committed Aug 19, 2020
1 parent c9cc7e2 commit afc6ffc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ it('not enough approval reviews', async () => {
})

it('no configuration should not schedule any pull request', async () => {
const schedulePullRequestTrigger = jest.fn()
jest.mock('../src/pull-request-handler', () => {
return {
schedulePullRequestTrigger: jest.fn()
schedulePullRequestTrigger
}
})

Expand All @@ -144,15 +145,15 @@ it('no configuration should not schedule any pull request', async () => {
github
})

expect(
app.receive(
createPullRequestOpenedEvent({
owner: 'bobvanderlinden',
repo: 'probot-auto-merge',
number: 1
})
)
).rejects.toHaveProperty('message', "Configuration file '.github/auto-merge.yml' not found")
app.receive(
createPullRequestOpenedEvent({
owner: 'bobvanderlinden',
repo: 'probot-auto-merge',
number: 1
})
)

expect(schedulePullRequestTrigger).toBeCalledTimes(0)
})

it('merges when receiving status event', async () => {
Expand Down

0 comments on commit afc6ffc

Please sign in to comment.