1
0
mirror of https://github.com/badges/shields.git synced 2025-12-01 18:37:54 +03:00
Files
shields/services/gitlab/gitlab-pipeline-status.tester.js
Paul Melnikow 4bd16f93e8 Sort imports and requires (#3056)
This will definitely save time, and ensure more uniformity.

It moves the `createServiceTester()` calls to a different place from where I'd like them, though I'm happy to have them checked by the linter.

Closes #2701
2019-02-21 22:14:40 -05:00

47 lines
1.1 KiB
JavaScript

'use strict'
const Joi = require('joi')
const { isBuildStatus } = require('../../lib/build-status')
const t = (module.exports = require('../tester').createServiceTester())
t.create('Pipeline status')
.get('/gitlab-org/gitlab-ce.json')
.expectJSONTypes(
Joi.object().keys({
name: 'build',
value: isBuildStatus,
})
)
t.create('Pipeline status (branch)')
.get('/gitlab-org/gitlab-ce/v10.7.6.json')
.expectJSONTypes(
Joi.object().keys({
name: 'build',
value: isBuildStatus,
})
)
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: isBuildStatus,
})
)