Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Aug 16, 2018
1 parent 496fe13 commit 3191ee2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion services/test-validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const isBuildStatus = Joi.equal(
'no tests',
'not built',
'not run',
'passed',
'passing',
'pending',
'processing',
Expand Down
9 changes: 3 additions & 6 deletions services/wercker/wercker.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ const werckerSchema = Joi.array()

module.exports = class Wercker extends BaseJsonService {
async fetch({ applicationName, projectId, branch }) {
let url = applicationName
const url = applicationName
? `https://app.wercker.com/api/v3/applications/${applicationName}/builds?limit=1`
: `https://app.wercker.com/getbuilds/${projectId}?limit=1`
if (branch) {
url += `&branch=${branch}`
}
return this._requestJson({
schema: werckerSchema,
url,
options: { qs: { branch } },
errorMessages: {
401: 'private application not supported',
404: 'application not found',
Expand All @@ -44,8 +42,7 @@ module.exports = class Wercker extends BaseJsonService {

async handle({ applicationName, projectId, branch }) {
const json = await this.fetch({ applicationName, projectId, branch })
const status = json[0].status
const result = json[0].result
const { status, result } = json[0]
return this.constructor.render({ status, result })
}

Expand Down

0 comments on commit 3191ee2

Please sign in to comment.