Files
shields/services/github/github-go-mod.tester.js
Hubert Jagodziński 727a033a9b Added [GithubGoModGoVersion GitHub] badge (#4232)
* Added Go version badge

* Using destructuring assignment

* Allowing a client to specify a filename

* Turned a test to live one

* Added golang to keywords

* Renamed parseContent to transform

* Added an example with branch and filename
2019-10-31 12:58:23 -05:00

40 lines
1.0 KiB
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 (mongorepo)')
.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',
})