Files
shields/service-tests/wordpress.js
Pyves 81b9f6ac53 [dotnetstatus github gratipay hexpm wordpress] General test improvements (#1177)
* Extended usage of the metric validators
* Fixed incorrect Worldpress test data
* Removed usages of Joi.equal for bare string literals
* Switched to proper star formatting and made tests more robust
* Removed debug
2017-10-15 16:58:54 -04:00

55 lines
1.2 KiB
JavaScript

'use strict';
const Joi = require('joi');
const ServiceTester = require('./runner/service-tester');
const {
isMetric,
isStarRating,
isVPlusDottedVersionAtLeastOne
} = require('./helpers/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
}));