* 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>
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
import { licenseToColor } from '../licenses.js'
|
|
import { createServiceTester } from '../tester.js'
|
|
export const t = await createServiceTester()
|
|
|
|
const publicDomainLicenseColor = licenseToColor('CC0-1.0')
|
|
const unknownLicenseColor = licenseToColor()
|
|
|
|
t.create('License')
|
|
.get('/github/gitignore.json')
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'CC0-1.0',
|
|
color: `#${publicDomainLicenseColor}`,
|
|
})
|
|
|
|
t.create('License for repo without a license')
|
|
.get('/badges/badger.json')
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'not specified',
|
|
color: 'lightgrey',
|
|
})
|
|
|
|
t.create('License for repo with an unrecognized license')
|
|
.get('/philokev/sopel-noblerealms.json')
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'not identifiable by github',
|
|
color: unknownLicenseColor,
|
|
})
|
|
|
|
t.create('License with SPDX id not appearing in configuration')
|
|
.get('/user1/project-with-EFL-license.json')
|
|
.intercept(nock =>
|
|
nock('https://api.github.com')
|
|
.get('/repos/user1/project-with-EFL-license')
|
|
.query(true)
|
|
// GitHub API currently returns "other" as a key for repo with EFL license
|
|
.reply(200, {
|
|
license: {
|
|
key: 'efl-1.0',
|
|
name: 'Eiffel Forum License v1.0',
|
|
spdx_id: 'EFL-1.0',
|
|
url: 'https://api.github.com/licenses/efl-1.0',
|
|
featured: true,
|
|
},
|
|
}),
|
|
)
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'EFL-1.0',
|
|
color: unknownLicenseColor,
|
|
})
|
|
|
|
t.create('License for unknown repo')
|
|
.get('/user1/github-does-not-have-this-repo.json')
|
|
.expectBadge({
|
|
label: 'license',
|
|
message: 'repo not found',
|
|
color: 'red',
|
|
})
|