Migrated most service tests to use new expectBadge (#3122)

This commit is contained in:
Pierre-Yves B
2019-02-28 21:43:23 +00:00
committed by GitHub
parent 4e2d144f97
commit 1f29c22d3d
230 changed files with 3480 additions and 4439 deletions

View File

@@ -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' })

View File

@@ -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' })

View File

@@ -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' })