Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions services/travis/travis-build.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export class TravisComBuild extends BaseSvgScrapingService {
static category = 'build'

static route = {
base: 'travis',
format: 'com/(?!php-v)([^/]+/[^/]+?)(?:/(.+?))?',
capture: ['userRepo', 'branch'],
base: 'travis/com',
pattern: ':user/:repo/:branch*',
}

static openApi = {
Expand Down Expand Up @@ -62,10 +61,10 @@ export class TravisComBuild extends BaseSvgScrapingService {
return renderBuildStatusBadge({ status })
}

async handle({ userRepo, branch }) {
async handle({ user, repo, branch }) {
const { message: status } = await this._requestSvg({
schema,
url: `https://api.travis-ci.com/${userRepo}.svg`,
url: `https://api.travis-ci.com/${user}/${repo}.svg`,
options: { searchParams: { branch } },
valueMatcher: />([^<>]+)<\/text><\/g>/,
})
Expand Down
8 changes: 4 additions & 4 deletions services/travis/travis-build.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()

t.create('build status on default branch')
.get('/com/ivandelabeldad/rackian-gateway.json')
.get('/ivandelabeldad/rackian-gateway.json')
.expectBadge({
label: 'build',
message: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
})

t.create('build status on named branch')
.get('/com/ivandelabeldad/rackian-gateway.json')
.get('/ivandelabeldad/rackian-gateway.json')
.expectBadge({
label: 'build',
message: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
})

t.create('unknown repo')
.get('/com/this-repo/does-not-exist.json')
.get('/this-repo/does-not-exist.json')
.expectBadge({ label: 'build', message: 'unknown' })

t.create('invalid svg response')
.get('/com/foo/bar.json')
.get('/foo/bar.json')
.intercept(nock =>
nock('https://api.travis-ci.com').get('/foo/bar.svg').reply(200),
)
Expand Down
Loading