Continue to implement #2698: - Add `core/base-service/index.js` (but hold off on moving the things it imports) - Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits. - Apply consistent ordering of imports and use of `module.exports` in testers. - Remove some renaming of imports. - Remove obsolete tests here and there.
32 lines
1023 B
JavaScript
32 lines
1023 B
JavaScript
'use strict'
|
|
|
|
const t = (module.exports = require('..').createServiceTester())
|
|
|
|
t.create('github pull request check state')
|
|
.get('/s/pulls/badges/shields/1110.json')
|
|
.expectJSON({ name: 'checks', value: 'failure' })
|
|
|
|
t.create('github pull request check state (pull request not found)')
|
|
.get('/s/pulls/badges/shields/5110.json')
|
|
.expectJSON({ name: 'checks', value: 'pull request or repo not found' })
|
|
|
|
t.create(
|
|
"github pull request check state (ref returned by github doesn't exist"
|
|
)
|
|
.get('/s/pulls/badges/shields/1110.json')
|
|
.intercept(
|
|
nock =>
|
|
nock('https://api.github.com', { allowUnmocked: true })
|
|
.get('/repos/badges/shields/pulls/1110')
|
|
.reply(200, JSON.stringify({ head: { sha: 'abc123' } })) // Looks like a real ref, but isn't.
|
|
)
|
|
.networkOn()
|
|
.expectJSON({
|
|
name: 'checks',
|
|
value: 'commit not found',
|
|
})
|
|
|
|
t.create('github pull request check contexts')
|
|
.get('/contexts/pulls/badges/shields/1110.json')
|
|
.expectJSON({ name: 'checks', value: '1 failure' })
|