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
chris48s 5b583cc9ef fix failing [gitlab] test (#6885)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-08-11 22:11:29 +00:00

45 lines
1.4 KiB
JavaScript

import { isBuildStatus } from '../build-status.js'
import { ServiceTester } from '../tester.js'
export const t = new ServiceTester({
id: 'GitlabPipeline',
title: 'Gitlab Pipeline',
pathPrefix: '/gitlab/pipeline',
})
t.create('Pipeline status').get('/gitlab-org/gitlab/v10.7.6.json').expectBadge({
label: 'build',
message: isBuildStatus,
})
t.create('Pipeline status (nonexistent branch)')
.get('/gitlab-org/gitlab/nope-not-a-branch.json')
.expectBadge({
label: 'build',
message: 'branch not found',
})
// Gitlab will redirect users to a sign-in page
// (which we ultimately see as a 503 error) in the event
// a nonexistent, or private, repository is specified.
// Given the additional complexity that would've been required to
// present users with a more traditional and friendly 'Not Found'
// error message, we will simply display inaccessible
// https://github.com/badges/shields/pull/5538
t.create('Pipeline status (nonexistent repo)')
.get('/this-repo/does-not-exist/master.json')
.expectBadge({
label: 'build',
message: 'inaccessible',
})
t.create('Pipeline status (custom gitlab URL)')
.get('/GNOME/pango/main.json?gitlab_url=https://gitlab.gnome.org')
.expectBadge({
label: 'build',
message: isBuildStatus,
})
t.create('Pipeline no branch redirect')
.get('/gitlab-org/gitlab.svg')
.expectRedirect('/gitlab/pipeline/gitlab-org/gitlab/master.svg')