* add optional distribution flag to GemVersion * add regex for rc versions * add example for latest version * change distribution path param to latest query param * rename latest to include_prereleases * remove redundant data validation Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
'use strict'
|
|
|
|
const {
|
|
isVPlusDottedVersionAtLeastOne,
|
|
withRegex,
|
|
} = require('../test-validators')
|
|
const t = (module.exports = require('../tester').createServiceTester())
|
|
|
|
t.create('version (valid)').get('/formatador.json').expectBadge({
|
|
label: 'gem',
|
|
message: isVPlusDottedVersionAtLeastOne,
|
|
})
|
|
|
|
t.create('version (not found)')
|
|
.get('/not-a-package.json')
|
|
.expectBadge({ label: 'gem', message: 'not found' })
|
|
|
|
// this is the same as isVPlusDottedVersionNClausesWithOptionalSuffix from test-validators.js
|
|
// except that it also accepts regexes like 5.0.0.rc5 - the . before the rc5 is not accepted in the original
|
|
const isVPlusDottedVersionNClausesWithOptionalSuffix = withRegex(
|
|
/^v\d+(\.\d+)*([-+~.].*)?$/
|
|
)
|
|
t.create('version including prereleases (valid)')
|
|
.get('/flame.json?include_prereleases')
|
|
.expectBadge({
|
|
label: 'gem',
|
|
message: isVPlusDottedVersionNClausesWithOptionalSuffix,
|
|
})
|
|
|
|
t.create('version including prereleases (not found)')
|
|
.get('/not-a-package.json?include_prereleases')
|
|
.expectBadge({ label: 'gem', message: 'not found' })
|