forked from mirrors/probot
test: request error logs
This commit is contained in:
parent
328d9f519b
commit
7ce6902b71
|
@ -8,6 +8,10 @@ describe('GitHubAPI', () => {
|
|||
beforeEach(() => {
|
||||
const options: Options = {
|
||||
logger,
|
||||
retry: {
|
||||
// disable retries to test error states
|
||||
enabled: false
|
||||
},
|
||||
throttle: {
|
||||
// disable throttling, otherwise tests are _slow_
|
||||
enabled: false
|
||||
|
@ -25,6 +29,19 @@ describe('GitHubAPI', () => {
|
|||
expect((await github.users.getAuthenticated({})).data).toEqual(user)
|
||||
})
|
||||
|
||||
test('logs request errors', async () => {
|
||||
nock('https://api.github.com')
|
||||
.get('/')
|
||||
.reply(500, {})
|
||||
|
||||
try {
|
||||
await github.request('/')
|
||||
throw new Error('should throw')
|
||||
} catch (error) {
|
||||
expect(error.status).toBe(500)
|
||||
}
|
||||
})
|
||||
|
||||
describe('paginate', () => {
|
||||
// Prepare an array of issue objects
|
||||
const issues = new Array(5).fill(0).map((_, i, arr) => {
|
||||
|
|
Loading…
Reference in New Issue