Fix tests and use helper

This commit is contained in:
Brandon Keepers 2016-10-11 23:22:29 -05:00
parent 02f84685f4
commit 80deaebe15
No known key found for this signature in database
GPG Key ID: F9533396D5FACBF6
3 changed files with 9 additions and 10 deletions

View File

@ -11,10 +11,7 @@
//
module.exports = function (github, payload, logins) {
return github.issues.removeAssigneesFromIssue({
owner: payload.repository.owner.login,
repo: payload.repository.name,
number: payload.issue.number,
body: {assignees: [].concat(logins)}
});
return github.issues.removeAssigneesFromIssue(
payload.toIssue({body: {assignees: [].concat(logins)}})
);
};

View File

@ -14,7 +14,8 @@
"github": "^5.0.1",
"github-webhook-handler": "^0.6.0",
"handlebars": "^4.0.5",
"js-yaml": "^3.6.1"
"js-yaml": "^3.6.1",
"jsdoc": "^3.4.2"
},
"devDependencies": {
"mocha": "^3.0.2",

View File

@ -1,6 +1,7 @@
const expect = require('expect');
const action = require('../../lib/actions/unassign');
const payload = require('../fixtures/webhook/comment.created.json');
const Payload = require('../../lib/payload');
const payload = new Payload(require('../fixtures/webhook/comment.created.json'));
const createSpy = expect.createSpy;
@ -17,7 +18,7 @@ describe('action.unassign', () => {
owner: 'bkeepers-inc',
repo: 'test',
number: 6,
body: ['bkeepers']
body: {assignees: ['bkeepers']}
});
});
@ -27,7 +28,7 @@ describe('action.unassign', () => {
owner: 'bkeepers-inc',
repo: 'test',
number: 6,
body: ['hello', 'world']
body: {assignees: ['hello', 'world']}
});
});
});