Skip to content

Commit

Permalink
test PUB monthly downloads badge
Browse files Browse the repository at this point in the history
  • Loading branch information
G1Joshi committed Dec 16, 2024
1 parent 77d904d commit 8b3d942
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions services/pub/pub-downloads.tester.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import { isMetric } from '../test-validators.js'
import { isMetricOverTimePeriod } from '../test-validators.js'
import { createServiceTester } from '../tester.js'

export const t = await createServiceTester()

t.create('pub downloads (valid)').get('/analysis_options.json').expectBadge({
label: 'downloads',
message: isMetric,
color: 'blue',
})
t.create('pub monthly downloads (valid)')
.get('/analysis_options.json')
.expectBadge({
label: 'downloads',
message: isMetricOverTimePeriod,
color: 'blue',
})

t.create('pub downloads (not found)').get('/analysisoptions.json').expectBadge({
label: 'downloads',
message: 'not found',
color: 'red',
})
t.create('pub monthly downloads (not found)')
.get('/analysisoptions.json')
.expectBadge({
label: 'downloads',
message: 'not found',
color: 'red',
})

t.create('pub downloads (invalid)').get('/analysis-options.json').expectBadge({
label: 'downloads',
message: 'invalid',
color: 'lightgrey',
})
t.create('pub monthly downloads (invalid)')
.get('/analysis-options.json')
.expectBadge({
label: 'downloads',
message: 'invalid',
color: 'lightgrey',
})

0 comments on commit 8b3d942

Please sign in to comment.