Skip to content

Commit

Permalink
Merge pull request #31 from bobvanderlinden/pr-no-configuration-test
Browse files Browse the repository at this point in the history
add test for no configuration
  • Loading branch information
probot-auto-merge[bot] committed Aug 24, 2018
2 parents 531b92d + f2f8aba commit 8f8f680
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,45 @@ it('full happy path', async () => {

expect(github.pullRequests.merge).toHaveBeenCalled()
})

it('no configuration should not schedule any pull request', async () => {
const app = new Application()

jest.mock('../src/pull-request-handler', () => {
return {
schedulePullRequestTrigger: jest.fn()
}
})

const github: any = {
repos: {
getContent: () => Promise.reject({ code: 404 })
}
} as DeepPartial<GitHubAPI>

app.auth = () => {
return Promise.resolve(github) as any
}

app.load(probotAutoMerge)

await app.receive({
event: 'pull_request',
payload: {
action: 'opened',
repository: {
owner: {
login: 'bobvanderlinden'
},
name: 'probot-auto-merge'
},
pull_request: {
number: 1
}
}
} as any)

const module: any = require('../src/pull-request-handler')

expect(module.schedulePullRequestTrigger).not.toHaveBeenCalled()
})

0 comments on commit 8f8f680

Please sign in to comment.