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.
31 lines
752 B
JavaScript
31 lines
752 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { dockerBlue } = require('./docker-helpers')
|
|
const { isMetric } = require('../test-validators')
|
|
|
|
const t = (module.exports = require('..').createServiceTester())
|
|
|
|
t.create('docker pulls (valid, library)')
|
|
.get('/_/ubuntu.json?style=_shields_test')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'docker pulls',
|
|
value: isMetric,
|
|
color: `#${dockerBlue}`,
|
|
})
|
|
)
|
|
|
|
t.create('docker pulls (valid, user)')
|
|
.get('/jrottenberg/ffmpeg.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'docker pulls',
|
|
value: isMetric,
|
|
})
|
|
)
|
|
|
|
t.create('docker pulls (not found)')
|
|
.get('/_/not-a-real-repo.json')
|
|
.expectJSON({ name: 'docker pulls', value: 'repo not found' })
|