Files
shields/services/librariesio/librariesio-dependent-repos.tester.js
Paul Melnikow a0c43ed219 Reduce boilerplate for creating new testers [npm appveyor gem uptimerobot clojars] (#1934)
This is a bit of sugar that reduces the boilerplate for creating testers in what I expect will become the standard case: a service in `foo/foo-thing.service.js` with its tests in `foo/foo-thing.tester.js`.

This makes a small stylistic change, which is to name the service by its CamelCase class name rather than an invented snake-case ID. Whereas before the name was specified in `class FooThing extends Base[Json]Service` and a second time in the tester, it now only needs to be specified once.
2018-08-22 18:07:51 -04:00

26 lines
567 B
JavaScript

'use strict'
const Joi = require('joi')
const createServiceTester = require('../create-service-tester')
const { isMetric } = require('../test-validators')
const t = createServiceTester()
module.exports = t
t.create('dependent repo count')
.get('/npm/got.json')
.expectJSONTypes(
Joi.object().keys({
name: 'dependent repos',
value: isMetric,
})
)
t.create('dependent repo count (not a package)')
.get('/npm/foobar-is-not-package.json')
.timeout(10000)
.expectJSON({
name: 'dependent repos',
value: 'package not found',
})