Skip to content

Commit

Permalink
Merge pull request #38 from Strider-CD/fix/tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
oliversalzburg authored Jul 12, 2016
2 parents fff8a20 + cd6523f commit a71b772
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,16 @@ function onCommit(context, req, res) {
return;
}

var data;
try {
//TODO check json parse (data object)
var data = JSON.parse(req.body.payload);
data = JSON.parse(req.body.payload);
} catch (e) {
res.status(400).send('Invalid json payload');
return;
}

/* jshint validthis: true */
var client = this.oauth(req.accountConfig());
var id = data.commits[data.commits.length - 1].raw_node;
var repositoryFullName = data.repository.absolute_url;
Expand Down Expand Up @@ -334,6 +336,7 @@ function onPullRequest(context, req, res) {
var isPullRequestPrepare = false;
var data = req.body;

/* jshint validthis: true */
var client = this.oauth(req.accountConfig());

if (!data.pullrequest_updated && !data.pullrequest_created) {
Expand Down
2 changes: 1 addition & 1 deletion test/test_webhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('The Webhooks parsing', function () {
var payload = require('./example_post')
describe('.parseHook(payload)', function () {
it('should parse an example', function () {
expect(api.postPayload(payload)).to.eql({
expect(api.parseCommitData(payload)).to.eql({
trigger: {
type: 'commit',
author: {
Expand Down

0 comments on commit a71b772

Please sign in to comment.