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

37 lines
819 B
JavaScript

'use strict';
const Joi = require('joi');
const ServiceTester = require('../service-tester');
const bzBugStatus = Joi.equal(
'unconfirmed',
'new',
'assigned',
'fixed',
'invalid',
'won\'t fix',
'duplicate',
'works for me',
'incomplete'
);
const t = new ServiceTester({ id: 'bugzilla', title: 'Bugzilla' });
module.exports = t;
t.create('Bugzilla valid bug status')
.get('/996038.json')
.inspectJSON()
.expectJSONTypes(Joi.object().keys({
name: 'bug 996038',
value: bzBugStatus
}));
t.create('Bugzilla invalid bug status')
.get('/83548978974387943879.json')
.expectJSON({ name: 'bug 83548978974387943879', value: 'not found' });
t.create('Bugzilla failed request bug status')
.get('/996038.json')
.networkOff()
.expectJSON({ name: 'bug 996038', value: 'inaccessible' });