* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * reformat all the things (prettier 3) * update tests to await calls to prettier.format() --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: chris48s <git@chris-shaw.dev>
85 lines
1.8 KiB
JavaScript
85 lines
1.8 KiB
JavaScript
import Joi from 'joi'
|
|
import { ServiceTester } from '../tester.js'
|
|
import { withRegex } from '../test-validators.js'
|
|
|
|
// same as isVPlusDottedVersionAtLeastOne, but also accepts an optional
|
|
// single lowercase alphabet letter suffix
|
|
// e.g.: v1.81a
|
|
const isVPlusDottedVersionAtLeastOneWithOptionalAlphabetLetter = withRegex(
|
|
/^v\d+(\.\d+)?(\.\d+)?[a-z]?$/,
|
|
)
|
|
|
|
export const t = new ServiceTester({
|
|
id: 'ctan',
|
|
title: 'Comprehensive TEX Archive Network',
|
|
})
|
|
|
|
t.create('license').get('/l/novel.json').expectBadge({
|
|
label: 'license',
|
|
message: 'lppl1.3c, ofl',
|
|
})
|
|
|
|
t.create('license missing')
|
|
.get('/l/novel.json')
|
|
.intercept(nock =>
|
|
nock('https://www.ctan.org')
|
|
.get('/json/2.0/pkg/novel')
|
|
.reply(200, {
|
|
version: {
|
|
number: 'notRelevant',
|
|
date: 'notRelevant',
|
|
},
|
|
}),
|
|
)
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'missing',
|
|
})
|
|
|
|
t.create('single license')
|
|
.get('/l/tex.json')
|
|
.intercept(nock =>
|
|
nock('https://www.ctan.org')
|
|
.get('/json/2.0/pkg/tex')
|
|
.reply(200, {
|
|
license: 'knuth',
|
|
version: {
|
|
number: 'notRelevant',
|
|
date: 'notRelevant',
|
|
},
|
|
}),
|
|
)
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'knuth',
|
|
})
|
|
|
|
t.create('version').get('/v/novel.json').expectBadge({
|
|
label: 'ctan',
|
|
message: isVPlusDottedVersionAtLeastOneWithOptionalAlphabetLetter,
|
|
})
|
|
|
|
t.create('version')
|
|
.get('/v/novel.json')
|
|
.intercept(nock =>
|
|
nock('https://www.ctan.org')
|
|
.get('/json/2.0/pkg/novel')
|
|
.reply(200, {
|
|
version: {
|
|
number: 'v1.11',
|
|
date: '',
|
|
},
|
|
}),
|
|
)
|
|
.expectBadge({
|
|
label: 'ctan',
|
|
message: 'v1.11',
|
|
color: 'blue',
|
|
})
|
|
|
|
t.create('date as version').get('/v/l3kernel.json').expectBadge({
|
|
label: 'ctan',
|
|
message: Joi.date().iso(),
|
|
color: 'blue',
|
|
})
|