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.
34 lines
898 B
JavaScript
34 lines
898 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { isBuildStatus } = require('../../lib/build-status')
|
|
|
|
const t = (module.exports = require('..').createServiceTester())
|
|
|
|
t.create('build status on default branch')
|
|
.get('/git-hub/doctrine/dbal.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'build',
|
|
value: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
|
|
})
|
|
)
|
|
|
|
t.create('build status on named branch')
|
|
.get('/git-hub/doctrine/dbal/develop.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'build',
|
|
value: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
|
|
})
|
|
)
|
|
|
|
t.create('unknown repo')
|
|
.get('/git-hub/this-repo/does-not-exist.json')
|
|
.expectJSON({ name: 'build', value: 'invalid' })
|
|
|
|
t.create('connection error')
|
|
.get('/git-hub/doctrine/dbal.json')
|
|
.networkOff()
|
|
.expectJSON({ name: 'build', value: 'invalid' })
|