Merging this separately so the commit with the tooling change is readable. This is a follow-on to #1167 which turned prettier on.
28 lines
666 B
JavaScript
28 lines
666 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const ServiceTester = require('../service-tester')
|
|
|
|
const t = new ServiceTester({ id: 'luarocks', title: 'LuaRocks' })
|
|
module.exports = t
|
|
|
|
const isLuaVersion = Joi.string().regex(/^v\d+\.\d+\.\d+-\d+$/)
|
|
|
|
t.create('version')
|
|
.get('/v/mpeterv/luacheck.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'luarocks',
|
|
value: isLuaVersion,
|
|
})
|
|
)
|
|
|
|
t.create('unknown package')
|
|
.get('/v/nil/does-not-exist.json')
|
|
.expectJSON({ name: 'luarocks', value: 'invalid' })
|
|
|
|
t.create('connection error')
|
|
.get('/v/mpeterv/luacheck.json')
|
|
.networkOff()
|
|
.expectJSON({ name: 'luarocks', value: 'inaccessible' })
|