committed by
Paul Melnikow
parent
47ba81a007
commit
79174d4cfc
@@ -96,4 +96,5 @@ module.exports = {
|
||||
makeLabel,
|
||||
makeLogo,
|
||||
makeBadgeData,
|
||||
makeColor
|
||||
};
|
||||
|
||||
@@ -65,6 +65,7 @@ const {
|
||||
getAnalytics
|
||||
} = require('./lib/analytics');
|
||||
const {
|
||||
makeColor,
|
||||
isValidStyle,
|
||||
isSixHex: sixHex,
|
||||
makeLabel: getLabel,
|
||||
@@ -6129,7 +6130,7 @@ cache(function(data, match, sendBadge, request) {
|
||||
badgeData.text[0] = data.label || ghLabel;
|
||||
badgeData.text[1] = '' + count;
|
||||
badgeData.colorscheme = null;
|
||||
badgeData.colorB = '#' + (color || '78bdf2');
|
||||
badgeData.colorB = makeColor(data.colorB || color || '78bdf2');
|
||||
sendBadge(format, badgeData);
|
||||
} catch(e) {
|
||||
badgeData.text[1] = 'invalid';
|
||||
|
||||
52
service-tests/waffle.js
Normal file
52
service-tests/waffle.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const Joi = require('joi');
|
||||
const ServiceTester = require('./runner/service-tester');
|
||||
|
||||
const t = new ServiceTester({ id: 'waffle', title: 'Waffle.io' });
|
||||
module.exports = t;
|
||||
|
||||
|
||||
const fakeData = [
|
||||
{
|
||||
githubMetadata: {
|
||||
labels: [
|
||||
{ color: "c5def5", name: "feature" },
|
||||
{ color: "fbca04", name: "bug" },
|
||||
{ color: "e11d21", name: "bug" }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
githubMetadata: {
|
||||
labels: [
|
||||
{ color: "c5def5", name: "feature" },
|
||||
{ color: "fbca04", name: "bug" },
|
||||
{ color: "e11d21", name: "feature" }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
githubMetadata: {
|
||||
labels: [
|
||||
{ color: "c5def5", name: "bug" },
|
||||
{ color: "fbca04", name: "bug" }
|
||||
]
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
t.create('label should be `bug` & value should be exactly 5 as supplied in `fakeData`. e.g: bug|5')
|
||||
.get('/label/userName/repoName/bug.json')
|
||||
.intercept(nock => nock('https://api.waffle.io/')
|
||||
.get('/userName/repoName/cards')
|
||||
.reply(200, fakeData))
|
||||
.expectJSONTypes(Joi.object().keys({
|
||||
name: Joi.equal('bug'),
|
||||
value: Joi.equal('5')
|
||||
}));
|
||||
|
||||
t.create('label should be `Mybug` & value should be formated. e.g: Mybug|25')
|
||||
.get('/label/ritwickdey/vscode-live-server/bug.json?label=Mybug')
|
||||
.expectJSONTypes(Joi.object().keys({
|
||||
name: Joi.equal('Mybug'),
|
||||
value: Joi.string().regex(/^\d+$/)
|
||||
}));
|
||||
Reference in New Issue
Block a user