Fix numeric colorB (#2780)

Numeric colors weren't properly being handled by `makeBadge` after #2742.

Since this function really does not need to be accepting colors as strings, rather than make the function more lenient to work with Scoutcamp, I coerced the types of the colors on the way in.

Two tests cover the functionality in the modern service. I don't feel strongly that the legacy version needs coverage at this point, though I've added one for the moment on the github languages badge where this manifested.

Fix #2778
This commit is contained in:
Paul Melnikow
2019-01-16 11:55:50 -05:00
committed by GitHub
parent 8a10279d95
commit 4bf55a7826
5 changed files with 34 additions and 4 deletions

View File

@@ -19,6 +19,16 @@ t.create('top language')
})
)
t.create('top language')
.get('/top/badges/shields.json?colorB=123&format=_shields_test')
.expectJSONTypes(
Joi.object().keys({
name: 'javascript',
value: Joi.string().regex(/^([1-9]?[0-9]\.[0-9]|100\.0)%$/),
color: '#123',
})
)
t.create('top language with empty repository')
.get('/top/pyvesb/emptyrepo.json')
.expectJSON({ name: 'language', value: 'none' })