Files
shields/services/github/github-issue-detail.tester.js
Caleb Cartwright 855c9cd261 Remove dev dep imports in production code (#2937)
Fixes #2876 with @paulmelnikow's suggestion 

Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
2019-02-05 21:51:55 -05:00

69 lines
1.7 KiB
JavaScript

'use strict'
const Joi = require('joi')
const { isFormattedDate } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('github issue state')
.get('/s/badges/shields/979.json')
.expectJSONTypes(
Joi.object().keys({
name: 'issue 979',
value: Joi.equal('open', 'closed'),
})
)
t.create('github issue state (repo not found)')
.get('/s/badges/helmets/979.json')
.expectJSON({
name: 'issue/pull request 979',
value: 'issue, pull request or repo not found',
})
t.create('github issue title')
.get('/title/badges/shields/979.json')
.expectJSONTypes(
Joi.object().keys({
name: 'issue 979',
value: 'Github rate limits cause transient service test failures in CI',
})
)
t.create('github issue author')
.get('/u/badges/shields/979.json')
.expectJSONTypes(Joi.object().keys({ name: 'author', value: 'paulmelnikow' }))
t.create('github issue label')
.get('/label/badges/shields/979.json')
.expectJSONTypes(
Joi.object().keys({
name: 'label',
value: Joi.equal(
'bug | developer-experience',
'developer-experience | bug'
),
})
)
t.create('github issue comments')
.get('/comments/badges/shields/979.json')
.expectJSONTypes(
Joi.object().keys({
name: 'comments',
value: Joi.number().greater(15),
})
)
t.create('github issue age')
.get('/age/badges/shields/979.json')
.expectJSONTypes(
Joi.object().keys({ name: 'created', value: isFormattedDate })
)
t.create('github issue update')
.get('/last-update/badges/shields/979.json')
.expectJSONTypes(
Joi.object().keys({ name: 'updated', value: isFormattedDate })
)