Files
shields/services/github/github-go-mod.tester.js
Hubert Jagodziński e236c9a15c Added [GithubRPackageVersion] badge (#5708)
* Added GithubRPackageVersion badge

* Minor changes to GithubGoModGoVersion badge

* More examples

* Removed mocking with nock from service tests

* Added unit tests

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-10-18 01:31:57 +00:00

38 lines
1014 B
JavaScript

'use strict'
const { isVPlusDottedVersionAtLeastOne } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('Go version').get('/gohugoio/hugo.json').expectBadge({
label: 'Go',
message: isVPlusDottedVersionAtLeastOne,
})
t.create('Go version (from branch)')
.get('/gohugoio/hugo/master.json')
.expectBadge({
label: 'Go@master',
message: isVPlusDottedVersionAtLeastOne,
})
t.create('Go version (monorepo)')
.get(`/golang/go.json?filename=${encodeURIComponent('src/go.mod')}`)
.expectBadge({
label: 'Go',
message: isVPlusDottedVersionAtLeastOne,
})
t.create('Go version (repo not found)')
.get('/badges/not-existing-repo.json')
.expectBadge({
label: 'Go',
message: 'repo not found, branch not found, or go.mod missing',
})
t.create('Go version (missing Go version in go.mod)')
.get('/calebcartwright/ci-detective.json')
.expectBadge({
label: 'Go',
message: 'Go version missing in go.mod',
})