Files
shields/services/static-badge/query-string-static.tester.js
Pierre-Yves B 25f8541e5b JSON format modernisation and _shields_test removal (#3272)
* Modernised JSON format and removed _shields_test style

* Added logoWidth and labelColor fields to JSON response

* Reinstated and updated comment

* Extended expectBadge to accept Joi schemas for all fields
2019-04-07 18:57:55 +01:00

32 lines
1.1 KiB
JavaScript

'use strict'
const t = (module.exports = require('../tester').createServiceTester())
t.create('Missing message')
.get('/static/v1.json?label=label&message=&color=blue')
.expectBadge({
label: 'label',
message: 'invalid query parameter: message',
color: 'red',
})
t.create('Missing label')
.get('/static/v1.json?label=&message=message&color=blue')
.expectBadge({ label: '', message: 'message', color: 'blue' })
t.create('Case is preserved')
.get('/static/v1.json?label=LiCeNsE&message=mIt&color=blue')
.expectBadge({ label: 'LiCeNsE', message: 'mIt', color: 'blue' })
t.create('Set color')
.get('/static/v1.json?label=label&message=message&color=yellow')
.expectBadge({ label: 'label', message: 'message', color: 'yellow' })
t.create('Set color with a number')
.get('/static/v1.json?label=label&message=message&color=123')
.expectBadge({ label: 'label', message: 'message', color: '#123' })
t.create('Set label')
.get('/static/v1.json?label=mylabel&message=message&color=blue')
.expectBadge({ label: 'mylabel', message: 'message', color: 'blue' })