* Bintray Downloads (Bintray Versions renamed and not changed) * Tests fix * Tests fix * Tests fix * Refactoring * PR suggestions * PR suggestions * PR suggestions Co-authored-by: Martynas Petuška <petuska.m@cambridgeassessment.org.uk> Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
33 lines
782 B
JavaScript
33 lines
782 B
JavaScript
'use strict'
|
|
|
|
const { isMetric } = require('../test-validators')
|
|
const t = (module.exports = require('../tester').createServiceTester())
|
|
|
|
t.create('downloads')
|
|
.get('/dt/asciidoctor/maven/asciidoctorj.json')
|
|
.expectBadge({
|
|
label: 'downloads',
|
|
message: isMetric,
|
|
})
|
|
|
|
t.create('downloads (not found)')
|
|
.get('/dt/asciidoctor/maven/not-a-real-package.json')
|
|
.expectBadge({
|
|
label: 'downloads',
|
|
message: 'not found',
|
|
})
|
|
|
|
t.create('downloads (mocked)')
|
|
.get('/dt/asciidoctor/maven/asciidoctorj.json')
|
|
.intercept(nock =>
|
|
nock('https://bintray.com')
|
|
.get('/api/ui/package/asciidoctor/maven/asciidoctorj/total_downloads')
|
|
.reply(200, {
|
|
totalDownloads: 420,
|
|
})
|
|
)
|
|
.expectBadge({
|
|
label: 'downloads',
|
|
message: '420',
|
|
})
|