Fixes #2876 with @paulmelnikow's suggestion Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
43 lines
905 B
JavaScript
43 lines
905 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { ServiceTester } = require('../tester')
|
|
const { isVPlusDottedVersionAtLeastOne } = require('../test-validators')
|
|
|
|
const t = (module.exports = new ServiceTester({
|
|
id: 'wordpress',
|
|
title: 'Wordpress Version Tests',
|
|
}))
|
|
|
|
t.create('Plugin Version')
|
|
.get('/plugin/v/akismet.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'plugin',
|
|
value: isVPlusDottedVersionAtLeastOne,
|
|
})
|
|
)
|
|
|
|
t.create('Theme Version')
|
|
.get('/theme/v/twentyseventeen.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'theme',
|
|
value: isVPlusDottedVersionAtLeastOne,
|
|
})
|
|
)
|
|
|
|
t.create('Plugin Version | Not Found')
|
|
.get('/plugin/v/100.json')
|
|
.expectJSON({
|
|
name: 'plugin',
|
|
value: 'not found',
|
|
})
|
|
|
|
t.create('Theme Version | Not Found')
|
|
.get('/theme/v/100.json')
|
|
.expectJSON({
|
|
name: 'theme',
|
|
value: 'not found',
|
|
})
|