|
| 1 | +import { createServiceTester } from '../tester.js' |
| 2 | +import { isMetric, isMetricOverTimePeriod } from '../test-validators.js' |
| 3 | + |
| 4 | +export const t = await createServiceTester() |
| 5 | + |
| 6 | +t.create('weekly downloads (valid)') |
| 7 | + .get('/dw/hashicorp/consul/aws.json') |
| 8 | + .expectBadge({ label: 'downloads', message: isMetricOverTimePeriod }) |
| 9 | + |
| 10 | +t.create('monthly downloads (valid)') |
| 11 | + .get('/dm/hashicorp/consul/aws.json') |
| 12 | + .expectBadge({ label: 'downloads', message: isMetricOverTimePeriod }) |
| 13 | + |
| 14 | +t.create('yearly downloads (valid)') |
| 15 | + .get('/dy/hashicorp/consul/aws.json') |
| 16 | + .expectBadge({ label: 'downloads', message: isMetricOverTimePeriod }) |
| 17 | + |
| 18 | +t.create('total downloads (valid)') |
| 19 | + .get('/dt/hashicorp/consul/aws.json') |
| 20 | + .expectBadge({ label: 'downloads', message: isMetric }) |
| 21 | + |
| 22 | +t.create('weekly downloads (not found)') |
| 23 | + .get('/dw/not/real/module.json') |
| 24 | + .expectBadge({ label: 'downloads', message: 'not found' }) |
| 25 | + |
| 26 | +t.create('monthly downloads (not found)') |
| 27 | + .get('/dm/not/real/module.json') |
| 28 | + .expectBadge({ label: 'downloads', message: 'not found' }) |
| 29 | + |
| 30 | +t.create('yearly downloads (not found)') |
| 31 | + .get('/dy/not/real/module.json') |
| 32 | + .expectBadge({ label: 'downloads', message: 'not found' }) |
| 33 | + |
| 34 | +t.create('total downloads (not found)') |
| 35 | + .get('/dt/not/real/module.json') |
| 36 | + .expectBadge({ label: 'downloads', message: 'not found' }) |
0 commit comments