fix getLabel to createLabel pipeline

This commit is contained in:
tbushman
2018-11-18 12:02:26 -07:00
committed by mrugesh mohapatra
parent 8960c082d4
commit e5501000df
2 changed files with 8 additions and 5 deletions

View File

@ -7,6 +7,7 @@ class Presolver {
owner,
repo
})
// console.log(this.config)
this.pullRequest = {}
this.conflictingFiles = []
}
@ -62,12 +63,13 @@ class Presolver {
async _createLabel (labelObj) {
const { owner, repo } = this.config
const github = this.github
console.log(this.github.issues.getLabel({ owner, repo, name: labelObj.name }))
return this.github.issues
.getLabels({ owner, repo, name: labelObj.name })
.getLabel({ owner, repo, name: labelObj.name })
.catch(() => {
// console.log(labelObj)
return this.github.issues.createLabel({
console.log(labelObj)
return github.issues.createLabel({
owner,
repo,
name: labelObj.name,
@ -93,6 +95,7 @@ class Presolver {
// Check if a label does not exist. If it does, it addes the label.
return this._getLabel(label).catch(() => {
// console.log(labelObj)
return this.github.issues.addLabels({
owner,
repo,

View File

@ -17,7 +17,7 @@ describe('Presolver', () => {
issues: {
createComment: jest.fn().mockReturnValue(Promise.resolve({})),
addLabels: jest.fn(),
getLabels: jest.fn().mockImplementation(() => Promise.resolve([])),
getLabel: jest.fn().mockImplementation(() => Promise.resolve([])),
createLabel: jest.fn()
},
repos: {