fix npm badges when maintainers not in response (#10286)
This commit is contained in:
@@ -21,7 +21,7 @@ const packageDataSchema = Joi.object({
|
||||
maintainers: Joi.array()
|
||||
// We don't need the keys here, just the length.
|
||||
.items(Joi.object({}))
|
||||
.required(),
|
||||
.default([]),
|
||||
types: Joi.string(),
|
||||
// `typings` is an alias for `types` and often used
|
||||
// https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package
|
||||
|
||||
@@ -16,3 +16,12 @@ t.create('contributor count for unknown package')
|
||||
label: 'npm collaborators',
|
||||
message: 'package not found',
|
||||
})
|
||||
|
||||
t.create('contributor count for package package without a maintainers property')
|
||||
.get('/package-without-maintainers.json')
|
||||
.intercept(nock =>
|
||||
nock('https://registry.npmjs.org')
|
||||
.get('/package-without-maintainers/latest')
|
||||
.reply(200, {}),
|
||||
)
|
||||
.expectBadge({ label: 'npm collaborators', message: '0' })
|
||||
|
||||
Reference in New Issue
Block a user