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:
@@ -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' })
|
||||
|
||||
Reference in New Issue
Block a user