Files
shields/services/jitpack/jitpack.tester.js
Paul Melnikow ea4b758612 Move service tests alongside code (#1563)
Per discussion in #1543
2018-03-20 18:32:48 -07:00

29 lines
806 B
JavaScript

'use strict';
const Joi = require('joi');
const ServiceTester = require('../service-tester');
// Github allows versions with chars, etc.
const isAnyV = Joi.string().regex(/^v.+$/);
const t = new ServiceTester({ id: 'jitpack', title: 'JitPack' });
module.exports = t;
t.create('version')
.get('/v/jitpack/maven-simple.json')
.expectJSONTypes(Joi.object().keys({ name: 'JitPack', value: isAnyV }));
t.create('unknown package')
.get('/v/some-bogus-user/project.json')
.expectJSON({ name: 'JitPack', value: 'invalid' });
t.create('unknown info')
.get('/z/devtools.json')
.expectStatus(404)
.expectJSON({ name: '404', value: 'badge not found' });
t.create('connection error')
.get('/v/jitpack/maven-simple.json')
.networkOff()
.expectJSON({ name: 'JitPack', value: 'inaccessible' });