mirror of
https://github.com/badges/shields.git
synced 2025-12-01 18:37:54 +03:00
There's a lot of demand for the Gitlab badges (#541) and the PR has been lingering, so I thought I'd start off one of the simple ones as a new-style service. This one is SVG-based, so it shouldn't require the API-token logic which could use some more testing and will require us to create an app and configure it on our server. We don't have any validation in place for `queryParams`. Probably this should be added to BaseService, though for the time being I extracted a helper function. Thanks to @LVMBDV for getting this work started in #1838!
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { isPipelineStatus } = require('./gitlab-helpers')
|
|
|
|
const t = require('../create-service-tester')()
|
|
module.exports = t
|
|
|
|
t.create('Pipeline status')
|
|
.get('/gitlab-org/gitlab-ce.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'build',
|
|
value: isPipelineStatus,
|
|
})
|
|
)
|
|
|
|
t.create('Pipeline status (branch)')
|
|
.get('/gitlab-org/gitlab-ce/v10.7.6.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'build',
|
|
value: isPipelineStatus,
|
|
})
|
|
)
|
|
|
|
t.create('Pipeline status (nonexistent branch)')
|
|
.get('/gitlab-org/gitlab-ce/nope-not-a-branch.json')
|
|
.expectJSON({
|
|
name: 'build',
|
|
value: 'branch not found',
|
|
})
|
|
|
|
t.create('Pipeline status (nonexistent repo)')
|
|
.get('/this-repo/does-not-exist.json')
|
|
.expectJSON({
|
|
name: 'build',
|
|
value: 'repo not found',
|
|
})
|
|
|
|
t.create('Pipeline status (custom gitlab URL)')
|
|
.get('/GNOME/pango.json?gitlab_url=https://gitlab.gnome.org')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'build',
|
|
value: isPipelineStatus,
|
|
})
|
|
)
|