-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
readthedocs.tester.js
38 lines (32 loc) · 1.07 KB
/
readthedocs.tester.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict'
const Joi = require('@hapi/joi')
const { isBuildStatus } = require('../build-status')
const t = (module.exports = require('../tester').createServiceTester())
t.create('build status')
.get('/pip.json')
.expectBadge({
label: 'docs',
message: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
})
t.create('build status for named version')
.get('/pip/stable.json')
.expectBadge({
label: 'docs',
message: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
})
t.create('build status for named semantic version')
.get('/scrapy/1.0.json')
.expectBadge({
label: 'docs',
message: Joi.alternatives().try(isBuildStatus, Joi.equal('unknown')),
})
t.create('build status for nonexistent version')
// This establishes that the version is being sent.
.get('/pip/foobar-is-not-a-version.json')
.expectBadge({
label: 'docs',
message: 'project or version not found',
})
t.create('unknown project')
.get('/this-repo/does-not-exist.json')
.expectBadge({ label: 'docs', message: 'project or version not found' })