forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-tag.tester.js
More file actions
46 lines (37 loc) · 1.31 KB
/
Copy pathgithub-tag.tester.js
File metadata and controls
46 lines (37 loc) · 1.31 KB
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
39
40
41
42
43
44
45
46
'use strict'
const Joi = require('joi')
const { isSemver } = require('../test-validators')
const { ServiceTester } = require('../tester')
const t = (module.exports = new ServiceTester({
id: 'GithubTag',
title: 'Github Tag',
pathPrefix: '/github',
}))
t.create('Tag')
.get('/v/tag/expressjs/express.json')
.expectBadge({ label: 'tag', message: isSemver, color: 'blue' })
t.create('Tag (inc pre-release)')
.get('/v/tag/expressjs/express.json?include_prereleases')
.expectBadge({
label: 'tag',
message: isSemver,
color: Joi.string().allow('blue', 'orange').required(),
})
t.create('Tag (no tags)')
.get('/v/tag/badges/daily-tests.json')
.expectBadge({ label: 'tag', message: 'no tags found' })
t.create('Tag (repo not found)')
.get('/v/tag/badges/helmets.json')
.expectBadge({ label: 'tag', message: 'repo not found' })
// redirects
t.create('Tag (legacy route: tag)')
.get('/tag/photonstorm/phaser.svg')
.expectRedirect('/github/v/tag/photonstorm/phaser.svg?sort=semver')
t.create('Tag (legacy route: tag-pre)')
.get('/tag-pre/photonstorm/phaser.svg')
.expectRedirect(
'/github/v/tag/photonstorm/phaser.svg?include_prereleases&sort=semver'
)
t.create('Tag (legacy route: tag-date)')
.get('/tag-date/photonstorm/phaser.svg')
.expectRedirect('/github/v/tag/photonstorm/phaser.svg')