Handle [cpan] versions that aren't returned as strings (#5239)
This commit is contained in:
@@ -8,6 +8,21 @@ t.create('version (valid)').get('/Config-Augeas.json').expectBadge({
|
||||
message: isVPlusDottedVersionAtLeastOne,
|
||||
})
|
||||
|
||||
t.create('version (version is a number rather than a string)')
|
||||
.get('/Config-Augeas.json')
|
||||
.intercept(nock =>
|
||||
nock('https://fastapi.metacpan.org')
|
||||
.get('/v1/release/Config-Augeas')
|
||||
.reply(200, {
|
||||
license: ['GPL'],
|
||||
version: 0.88,
|
||||
})
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'cpan',
|
||||
message: 'v0.88',
|
||||
})
|
||||
|
||||
t.create('version (not found)').get('/not-a-package.json').expectBadge({
|
||||
label: 'cpan',
|
||||
message: 'not found',
|
||||
|
||||
@@ -4,7 +4,7 @@ const Joi = require('@hapi/joi')
|
||||
const { BaseJsonService } = require('..')
|
||||
|
||||
const schema = Joi.object({
|
||||
version: Joi.string().required(),
|
||||
version: Joi.alternatives(Joi.string().required(), Joi.number().required()),
|
||||
license: Joi.array().items(Joi.string()).min(1).required(),
|
||||
}).required()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user