forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 1
/
npm-dependency-version.tester.js
46 lines (39 loc) · 1.16 KB
/
npm-dependency-version.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
39
40
41
42
43
44
45
46
'use strict'
const { semverRange } = require('../validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('gets the peer dependency version')
.get('/react-boxplot/peer/react.json')
.expectBadge({
label: 'react',
message: semverRange,
})
t.create('gets the dev dependency version')
.get('/react-boxplot/dev/react.json?label=react%20tested')
.expectBadge({
label: 'react tested',
message: semverRange,
})
t.create('gets the dev dependency version (scoped)')
.get('/@metabolize/react-flexbox-svg/dev/eslint.json?')
.expectBadge({
label: 'eslint',
message: semverRange,
})
t.create('gets the dev dependency version (scoped dependency)')
.get('/mocha/dev/@mocha/contributors.json')
.expectBadge({
label: '@mocha/contributors',
message: semverRange,
})
t.create('gets the prod dependency version')
.get('/react-boxplot/simple-statistics.json')
.expectBadge({
label: 'simple-statistics',
message: semverRange,
})
t.create('unknown dependency')
.get('/react-boxplot/dev/i-made-this-up.json')
.expectBadge({
label: 'dependency',
message: 'dev dependency not found',
})