Migrated most service tests to use new expectBadge (#3122)
This commit is contained in:
@@ -11,33 +11,33 @@ const t = (module.exports = new ServiceTester({
|
||||
|
||||
t.create('total downloads')
|
||||
.get('/d/libc.json')
|
||||
.expectJSONTypes({ name: 'downloads', value: isMetric })
|
||||
.expectBadge({ label: 'downloads', message: isMetric })
|
||||
|
||||
t.create('total downloads (with version)')
|
||||
.get('/d/libc/0.2.31.json')
|
||||
.expectJSONTypes({
|
||||
name: 'downloads@0.2.31',
|
||||
value: isMetric,
|
||||
.expectBadge({
|
||||
label: 'downloads@0.2.31',
|
||||
message: isMetric,
|
||||
})
|
||||
|
||||
t.create('downloads for version')
|
||||
.get('/dv/libc.json')
|
||||
.expectJSONTypes({
|
||||
name: 'downloads@latest',
|
||||
value: isMetric,
|
||||
.expectBadge({
|
||||
label: 'downloads@latest',
|
||||
message: isMetric,
|
||||
})
|
||||
|
||||
t.create('downloads for version (with version)')
|
||||
.get('/dv/libc/0.2.31.json')
|
||||
.expectJSONTypes({
|
||||
name: 'downloads@0.2.31',
|
||||
value: isMetric,
|
||||
.expectBadge({
|
||||
label: 'downloads@0.2.31',
|
||||
message: isMetric,
|
||||
})
|
||||
|
||||
t.create('downloads (invalid version)')
|
||||
.get('/d/libc/7.json')
|
||||
.expectJSON({ name: 'crates.io', value: 'invalid semver: 7' })
|
||||
.expectBadge({ label: 'crates.io', message: 'invalid semver: 7' })
|
||||
|
||||
t.create('downloads (not found)')
|
||||
.get('/d/not-a-real-package.json')
|
||||
.expectJSON({ name: 'crates.io', value: 'not found' })
|
||||
.expectBadge({ label: 'crates.io', message: 'not found' })
|
||||
|
||||
@@ -10,12 +10,12 @@ const t = (module.exports = new ServiceTester({
|
||||
|
||||
t.create('license')
|
||||
.get('/libc.json')
|
||||
.expectJSON({ name: 'license', value: 'MIT OR Apache-2.0' })
|
||||
.expectBadge({ label: 'license', message: 'MIT OR Apache-2.0' })
|
||||
|
||||
t.create('license (with version)')
|
||||
.get('/libc/0.2.44.json')
|
||||
.expectJSON({ name: 'license', value: 'MIT OR Apache-2.0' })
|
||||
.expectBadge({ label: 'license', message: 'MIT OR Apache-2.0' })
|
||||
|
||||
t.create('license (not found)')
|
||||
.get('/not-a-real-package.json')
|
||||
.expectJSON({ name: 'crates.io', value: 'not found' })
|
||||
.expectBadge({ label: 'crates.io', message: 'not found' })
|
||||
|
||||
@@ -11,8 +11,8 @@ const t = (module.exports = new ServiceTester({
|
||||
|
||||
t.create('version')
|
||||
.get('/libc.json')
|
||||
.expectJSONTypes({ name: 'crates.io', value: isSemver })
|
||||
.expectBadge({ label: 'crates.io', message: isSemver })
|
||||
|
||||
t.create('version (not found)')
|
||||
.get('/not-a-real-package.json')
|
||||
.expectJSON({ name: 'crates.io', value: 'not found' })
|
||||
.expectBadge({ label: 'crates.io', message: 'not found' })
|
||||
|
||||
Reference in New Issue
Block a user