- Replace the idea of color schemes with the idea of named colors (since none of our colorschemes have used `colorA`)
- Pass through the normalized color to `_shields_test` to harmonize with BaseService and simplify testing
- Update service tests
- Move responsibility for color generation into the npm package
- Remove several color helper functions and their tests
- Update gh-badge public API to accept `color` and `labelColor`
This is a precursor to refactoring some of the logo code for #2473.
31 lines
754 B
JavaScript
31 lines
754 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { dockerBlue } = require('./docker-helpers')
|
|
const { isMetric } = require('../test-validators')
|
|
|
|
const t = (module.exports = require('../create-service-tester')())
|
|
|
|
t.create('docker pulls (valid, library)')
|
|
.get('/_/ubuntu.json?style=_shields_test')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'docker pulls',
|
|
value: isMetric,
|
|
color: `#${dockerBlue}`,
|
|
})
|
|
)
|
|
|
|
t.create('docker pulls (valid, user)')
|
|
.get('/jrottenberg/ffmpeg.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'docker pulls',
|
|
value: isMetric,
|
|
})
|
|
)
|
|
|
|
t.create('docker pulls (not found)')
|
|
.get('/_/not-a-real-repo.json')
|
|
.expectJSON({ name: 'docker pulls', value: 'repo not found' })
|