Files
shields/services/npm/npm-collaborators.tester.js
Paul Melnikow a3a52524fc Add [npm] badges for collaborator count and dependency version (#2461)
This adds a badge for collaborator count. When evaluating a library, it can be useful to know that there's not a single-contributor bottleneck for publishing. Having more than one collaborator is a sign of library maturity.

It adds another badge for dependency version of published dependencies, which solves a similar problem as the node-version badge. I will find this useful for making sure dependencies are up to date in a library.
2018-12-12 15:02:37 -05:00

25 lines
742 B
JavaScript

'use strict'
const Joi = require('joi')
const { nonNegativeInteger } = require('../validators')
const t = (module.exports = require('../create-service-tester')())
t.create('gets the contributor count')
.get('/prettier.json')
.expectJSONTypes(
Joi.object({ name: 'npm collaborators', value: nonNegativeInteger })
)
t.create('gets the contributor count from a custom registry')
.get('/prettier.json?registry_uri=https://registry.npmjs.com')
.expectJSONTypes(
Joi.object({ name: 'npm collaborators', value: nonNegativeInteger })
)
t.create('contributor count for unknown package')
.get('/npm-registry-does-not-have-this-package.json')
.expectJSON({
name: 'npm collaborators',
value: 'package not found',
})