Make [Coveralls] examples consistent with regards to VCS parameter (#6181)
* Make [Coveralls] examples consistent with regards to VCS parameter * Implement redirector for missing VCS type
This commit is contained in:
17
services/coveralls/coveralls-redirector.service.js
Normal file
17
services/coveralls/coveralls-redirector.service.js
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
const { redirector } = require('..')
|
||||
|
||||
module.exports = [
|
||||
redirector({
|
||||
name: 'CoverallsGitHubRedirect',
|
||||
category: 'coverage',
|
||||
route: {
|
||||
base: 'coveralls',
|
||||
pattern: ':user((?!github|bitbucket).*)/:repo/:branch*',
|
||||
},
|
||||
transformPath: ({ user, repo, branch }) =>
|
||||
`/coveralls/github/${user}/${repo}${branch ? `/${branch}` : ''}`,
|
||||
dateAdded: new Date('2021-02-23'),
|
||||
}),
|
||||
]
|
||||
13
services/coveralls/coveralls-redirector.tester.js
Normal file
13
services/coveralls/coveralls-redirector.tester.js
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
const { ServiceTester } = require('../tester')
|
||||
|
||||
const t = (module.exports = new ServiceTester({
|
||||
id: 'CoverallsGitHubRedirect',
|
||||
title: 'Coveralls GitHub Redirector',
|
||||
pathPrefix: '/coveralls',
|
||||
}))
|
||||
|
||||
t.create('Coveralls VCS type missing')
|
||||
.get('/lemurheavy/coveralls-ruby.svg')
|
||||
.expectRedirect('/coveralls/github/lemurheavy/coveralls-ruby.svg')
|
||||
@@ -12,42 +12,25 @@ module.exports = class Coveralls extends BaseJsonService {
|
||||
static category = 'coverage'
|
||||
static route = {
|
||||
base: 'coveralls',
|
||||
pattern: ':vcsType(github|bitbucket)?/:user/:repo/:branch*',
|
||||
pattern: ':vcsType(github|bitbucket)/:user/:repo/:branch*',
|
||||
}
|
||||
|
||||
static examples = [
|
||||
{
|
||||
title: 'Coveralls github',
|
||||
pattern: ':vcsType/:user/:repo',
|
||||
title: 'Coveralls',
|
||||
namedParams: { vcsType: 'github', user: 'jekyll', repo: 'jekyll' },
|
||||
pattern: ':vcsType(github|bitbucket)/:user/:repo',
|
||||
staticPreview: this.render({ coverage: 86 }),
|
||||
},
|
||||
{
|
||||
title: 'Coveralls github branch',
|
||||
pattern: ':vcsType/:user/:repo/:branch',
|
||||
namedParams: {
|
||||
vcsType: 'github',
|
||||
user: 'lemurheavy',
|
||||
repo: 'coveralls-ruby',
|
||||
branch: 'master',
|
||||
},
|
||||
staticPreview: this.render({ coverage: 91.81 }),
|
||||
},
|
||||
{
|
||||
title: 'Coveralls bitbucket',
|
||||
pattern: ':vcsType/:user/:repo',
|
||||
namedParams: { vcsType: 'bitbucket', user: 'pyKLIP', repo: 'pyklip' },
|
||||
staticPreview: this.render({ coverage: 86 }),
|
||||
},
|
||||
{
|
||||
title: 'Coveralls bitbucket branch',
|
||||
pattern: ':vcsType/:user/:repo/:branch',
|
||||
title: 'Coveralls branch',
|
||||
namedParams: {
|
||||
vcsType: 'bitbucket',
|
||||
user: 'pyKLIP',
|
||||
repo: 'pyklip',
|
||||
branch: 'master',
|
||||
},
|
||||
pattern: ':vcsType(github|bitbucket)/:user/:repo/:branch',
|
||||
staticPreview: this.render({ coverage: 96 }),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -15,10 +15,6 @@ t.create('github branch coverage')
|
||||
.get('/github/lemurheavy/coveralls-ruby/master.json')
|
||||
.expectBadge({ label: 'coverage', message: isIntegerPercentage })
|
||||
|
||||
t.create('github coverage for legacy link')
|
||||
.get('/jekyll/jekyll.json')
|
||||
.expectBadge({ label: 'coverage', message: isIntegerPercentage })
|
||||
|
||||
t.create('bitbucket coverage')
|
||||
.get('/bitbucket/pyKLIP/pyklip.json')
|
||||
.expectBadge({ label: 'coverage', message: isIntegerPercentage })
|
||||
|
||||
Reference in New Issue
Block a user