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 226fa67a02 Create shortcut for BaseService-related imports (#2809)
Continue to implement #2698:

- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.
2019-01-21 15:41:24 -05:00

48 lines
1.0 KiB
JavaScript

'use strict'
const Joi = require('joi')
const { isBuildStatus } = require('../../lib/build-status')
const t = (module.exports = require('..').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,
})
)