This moves a few helpers from `lib/` to `services/`: build-status.js build-status.spec.js color-formatters.js color-formatters.spec.js contributor-count.js licenses.js licenses.spec.js php-version.js php-version.spec.js text-formatters.js text-formatters.spec.js version.js version.spec.js And one from `lib/` to `core/`: unhandled-rejection.spec.js The diff is long, but the changes are straightforward. Ref #2832
33 lines
897 B
JavaScript
33 lines
897 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { isBuildStatus } = require('../build-status')
|
|
const t = (module.exports = require('../tester').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' })
|