Skip to content

Commit

Permalink
[Github] issues: Accommodate multi-word labels (#1135)
Browse files Browse the repository at this point in the history
Fix #1134
  • Loading branch information
paulmelnikow authored Oct 9, 2017
1 parent 271bb4b commit c579ed7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@ cache(function(data, match, sendBadge, request) {
query.q = 'repo:' + user + '/' + repo +
(isPR? ' is:pr': ' is:issue') +
(isClosed? ' is:closed': ' is:open') +
(hasLabel? ' label:' + ghLabel: '');
(hasLabel? ` label:"${ghLabel}"` : '');

var classText = isClosed? 'closed': 'open';
var leftClassText = isRaw? classText + ' ': '';
Expand Down
20 changes: 14 additions & 6 deletions service-tests/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,25 @@ t.create('GitHub open issues raw')
.get('/issues-raw/badges/shields.json')
.expectJSONTypes(Joi.object().keys({ name: 'open issues', value: isMetric }));

t.create('GitHub open issues by label')
.get('/issues/badges/shields/vendor-badge.json')
t.create('GitHub open issues by label is > zero')
.get('/issues/badges/shields/service-badge.json')
.expectJSONTypes(Joi.object().keys({
name: Joi.equal('vendor-badge issues'),
value: Joi.string().regex(/^[0-9]+[kMGTPEZY]? open$/)
name: Joi.equal('service-badge issues'),
value: Joi.string().regex(/^[1-9][0-9]*[kMGTPEZY]? open$/)
}));

t.create('GitHub open issues by label is > zero')
.get('/issues/Cockatrice/Cockatrice/Easy%20Change.json')
.inspectJSON()
.expectJSONTypes(Joi.object().keys({
name: Joi.equal('Easy Change issues'),
value: Joi.string().regex(/^[1-9][0-9]*[kMGTPEZY]? open$/)
}));

t.create('GitHub open issues by label (raw)')
.get('/issues-raw/badges/shields/vendor-badge.json')
.get('/issues-raw/badges/shields/service-badge.json')
.expectJSONTypes(Joi.object().keys({
name: Joi.equal('open vendor-badge issues'),
name: Joi.equal('open service-badge issues'),
value: isMetric
}));

Expand Down

0 comments on commit c579ed7

Please sign in to comment.