I started using this one-line boilerplate a while back and it seems to tidy things up a bit.
32 lines
770 B
JavaScript
32 lines
770 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
|
|
const isTypeDefinition = Joi.string().regex(
|
|
/^((Flow|TypeScript)|(Flow \| TypeScript))$/
|
|
)
|
|
|
|
const t = (module.exports = require('../create-service-tester')())
|
|
|
|
t.create('types (from dev dependencies + files)')
|
|
.get('/chalk.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({ name: 'types', value: isTypeDefinition })
|
|
)
|
|
|
|
t.create('types (from files)')
|
|
.get('/form-data-entries.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({ name: 'types', value: isTypeDefinition })
|
|
)
|
|
|
|
t.create('types (from types key)')
|
|
.get('/left-pad.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({ name: 'types', value: isTypeDefinition })
|
|
)
|
|
|
|
t.create('no types')
|
|
.get('/link-into.json')
|
|
.expectJSON({ name: 'types', value: 'none' })
|