Files
shields/services/docker/docker-automated.tester.js
chris48s 8621fe42d7 Upgrade Joi (#3505)
* upgrade joi
* find & replace ALL THE THINGS
* update related deps
2019-06-02 21:59:55 +01:00

48 lines
1.3 KiB
JavaScript

'use strict'
const Joi = require('@hapi/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' })