Files
shields/services/wordpress/wordpress-last-update.tester.js
Joe Izzard d60b90b860 [Wordpress] Theme & Plugin Last Updated badge (#5722)
* feat: added schema and API options for new badge

* fix: fixed platform test's for new schema and api options

* feat: added new badge for theme and plugin last updated

* test: added testing for new badge

* feat: added regex pattern for last update string

* fix: fixed mock test's that didn't match regex pattern

* refactor: changed to moment formatting

Changed to use the moment lib to validate and format last_update date strings from upstream API

* fix: fixed failing platform service tests

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2020-10-20 17:44:58 +00:00

39 lines
873 B
JavaScript

'use strict'
const { ServiceTester } = require('../tester')
const { isFormattedDate } = require('../test-validators')
const t = new ServiceTester({
id: 'wordpress',
title: 'WordPress Last Update',
})
module.exports = t
t.create('Plugin Last Update')
.get('/plugin/last-updated/akismet.json')
.expectBadge({
label: 'last updated',
message: isFormattedDate,
})
t.create('Plugin (Not Found)')
.get('/plugin/last-updated/pleasenevermakethisplugin.json')
.expectBadge({
label: 'last updated',
message: 'not found',
})
t.create('Theme Last Update')
.get('/theme/last-updated/twentytwenty.json')
.expectBadge({
label: 'last updated',
message: isFormattedDate,
})
t.create('Theme (Not Found)')
.get('/theme/last-updated/pleasenevermakethistheme.json')
.expectBadge({
label: 'last updated',
message: 'not found',
})