Merging this separately so the commit with the tooling change is readable. This is a follow-on to #1167 which turned prettier on.
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const ServiceTester = require('../service-tester')
|
|
const {
|
|
isMetric,
|
|
isStarRating,
|
|
isVPlusDottedVersionAtLeastOne,
|
|
} = require('../test-validators')
|
|
|
|
const t = new ServiceTester({ id: 'wordpress', title: 'Wordpress' })
|
|
module.exports = t
|
|
|
|
t.create('supported version')
|
|
.get('/v/akismet.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'wordpress',
|
|
value: Joi.string().regex(/^\d+(\.\d+)?(\.\d+)? tested$/),
|
|
})
|
|
)
|
|
|
|
t.create('plugin version')
|
|
.get('/plugin/v/akismet.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'plugin',
|
|
value: isVPlusDottedVersionAtLeastOne,
|
|
})
|
|
)
|
|
|
|
t.create('plugin rating')
|
|
.get('/plugin/r/akismet.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'rating',
|
|
value: isStarRating,
|
|
})
|
|
)
|
|
|
|
t.create('plugin downloads')
|
|
.get('/plugin/dt/akismet.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'downloads',
|
|
value: isMetric,
|
|
})
|
|
)
|
|
|
|
t.create('theme rating')
|
|
.get('/theme/r/hestia.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'rating',
|
|
value: isStarRating,
|
|
})
|
|
)
|
|
|
|
t.create('theme downloads')
|
|
.get('/theme/dt/hestia.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'downloads',
|
|
value: isMetric,
|
|
})
|
|
)
|