* update joi + joi-extension-semver * @hapi/joi --> joi Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
33 lines
891 B
JavaScript
33 lines
891 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const t = (module.exports = require('../tester').createServiceTester())
|
|
|
|
const isTypeDefinition = Joi.string().regex(
|
|
/^((Flow|TypeScript)|(Flow \| TypeScript))$/
|
|
)
|
|
|
|
t.create('types (from dev dependencies)')
|
|
.get('/commander.json')
|
|
.expectBadge({ label: 'types', message: isTypeDefinition })
|
|
|
|
t.create('types (from files)')
|
|
.get('/form-data-entries.json')
|
|
.intercept(nock =>
|
|
nock('https://registry.npmjs.org')
|
|
.get(`/form-data-entries/latest`)
|
|
.reply(200, {
|
|
maintainers: [],
|
|
files: ['index.js', 'index.d.ts'],
|
|
})
|
|
)
|
|
.expectBadge({ label: 'types', message: isTypeDefinition })
|
|
|
|
t.create('types (from types key)')
|
|
.get('/left-pad.json')
|
|
.expectBadge({ label: 'types', message: isTypeDefinition })
|
|
|
|
t.create('no types')
|
|
.get('/link-into.json')
|
|
.expectBadge({ label: 'types', message: 'none' })
|