Skip to content

Commit

Permalink
add service test for static badge
Browse files Browse the repository at this point in the history
  • Loading branch information
RedSparr0w committed Jul 23, 2018
1 parent 88410a9 commit a2a93ae
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions services/badge/badge.tester.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

const Joi = require('joi');
const ServiceTester = require('../service-tester');

const t = new ServiceTester({ id: 'static-badge', title: 'Static Badge', pathPrefix: '/badge' });
module.exports = t;


// version endpoint

t.create('Shields colorscheme color')
.get('/label-message-blue.json?style=_shields_test')
.expectJSON({name: 'label', value: 'message', colorB: '#007ec6'});

t.create('CSS named color')
.get('/label-message-whitesmoke.json?style=_shields_test')
.expectJSON({name: 'label', value: 'message', colorB: 'whitesmoke'});

t.create('RGB color')
.get('/label-message-rgb(123,123,123).json?style=_shields_test')
.expectJSON({name: 'label', value: 'message', colorB: 'rgb(123,123,123)'});

t.create('Not a valid color')
.get('/label-message-notacolor.json?style=_shields_test')
.expectJSON({name: 'label', value: 'message', colorB: '#e05d44'});

t.create('Missing message')
.get('/label--blue.json?style=_shields_test')
.expectJSON({name: 'label', value: 'n/a', colorB: '#007ec6'});

t.create('Missing label')
.get('/-message-blue.json?style=_shields_test')
.expectJSON({name: 'unknown', value: 'message', colorB: '#007ec6'});

t.create('Override colorB')
.get('/label-message-blue.json?style=_shields_test&colorB=yellow')
.expectJSON({name: 'label', value: 'message', colorB: '#dfb317'});

t.create('Override label')
.get('/label-message-blue.json?style=_shields_test&label=mylabel')
.expectJSON({name: 'mylabel', value: 'message', colorB: '#007ec6'});

0 comments on commit a2a93ae

Please sign in to comment.