Files
shields/services/docker/docker-automated.tester.js
Pierre-Yves B 25f8541e5b JSON format modernisation and _shields_test removal (#3272)
* Modernised JSON format and removed _shields_test style

* Added logoWidth and labelColor fields to JSON response

* Reinstated and updated comment

* Extended expectBadge to accept Joi schemas for all fields
2019-04-07 18:57:55 +01:00

48 lines
1.3 KiB
JavaScript

'use strict'
const Joi = require('joi')
const t = (module.exports = require('../tester').createServiceTester())
const { dockerBlue } = require('./docker-helpers')
const isAutomatedBuildStatus = Joi.string().valid('automated', 'manual')
t.create('docker automated build (valid, library)')
.get('/_/ubuntu.json')
.expectBadge({
label: 'docker build',
message: isAutomatedBuildStatus,
})
t.create('docker automated build (valid, user)')
.get('/jrottenberg/ffmpeg.json')
.expectBadge({
label: 'docker build',
message: isAutomatedBuildStatus,
})
t.create('docker automated build (not found)')
.get('/_/not-a-real-repo.json')
.expectBadge({ label: 'docker build', message: 'repo not found' })
t.create('docker automated build - automated')
.get('/_/ubuntu.json')
.intercept(nock =>
nock('https://registry.hub.docker.com/')
.get('/v2/repositories/library/ubuntu')
.reply(200, { is_automated: true })
)
.expectBadge({
label: 'docker build',
message: 'automated',
color: `#${dockerBlue}`,
})
t.create('docker automated build - manual')
.get('/_/ubuntu.json')
.intercept(nock =>
nock('https://registry.hub.docker.com/')
.get('/v2/repositories/library/ubuntu')
.reply(200, { is_automated: false })
)
.expectBadge({ label: 'docker build', message: 'manual', color: 'yellow' })