Files
shields/services/crates/crates-downloads.tester.js
dependabot[bot] b9d96755ec chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2023-07-10 09:27:51 +00:00

63 lines
1.7 KiB
JavaScript

import { isMetric } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('total downloads')
.get('/d/libc.json')
.expectBadge({ label: 'downloads', message: isMetric })
t.create('total downloads (with version)')
.get('/d/libc/0.2.31.json')
.expectBadge({
label: 'downloads@0.2.31',
message: isMetric,
})
t.create('downloads for version').get('/dv/libc.json').expectBadge({
label: 'downloads@latest',
message: isMetric,
})
t.create('downloads for version (with version)')
.get('/dv/libc/0.2.31.json')
.expectBadge({
label: 'downloads@0.2.31',
message: isMetric,
})
t.create('recent downloads').get('/dr/libc.json').expectBadge({
label: 'recent downloads',
message: isMetric,
})
t.create('recent downloads (null)')
.get('/dr/libc.json')
.intercept(nock =>
nock('https://crates.io')
.get('/api/v1/crates/libc?include=versions,downloads')
.reply(200, {
crate: {
downloads: 42,
recent_downloads: null,
max_version: '0.2.71',
},
versions: [{ downloads: 42, license: 'MIT OR Apache-2.0' }],
}),
)
.expectBadge({ label: 'recent downloads', message: '0' })
t.create('recent downloads (with version)')
.get('/dr/libc/0.2.31.json')
.expectBadge({
label: 'crates.io',
message: 'recent downloads not supported for specific versions',
})
t.create('downloads (invalid version)')
.get('/d/libc/7.json')
.expectBadge({ label: 'crates.io', message: 'invalid semver: 7' })
t.create('downloads (not found)')
.get('/d/not-a-real-package.json')
.expectBadge({ label: 'crates.io', message: 'not found' })