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
Caleb Cartwright 855c9cd261 Remove dev dep imports in production code (#2937)
Fixes #2876 with @paulmelnikow's suggestion 

Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
2019-02-05 21:51:55 -05:00

48 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,
})
)