From e5501000df3e99afdd9794db2f80c5ce21f17ce3 Mon Sep 17 00:00:00 2001 From: tbushman Date: Sun, 18 Nov 2018 12:02:26 -0700 Subject: [PATCH] fix getLabel to createLabel pipeline --- probot/presolver/lib/presolver.js | 11 +++++++---- probot/presolver/test/index.test.js | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/probot/presolver/lib/presolver.js b/probot/presolver/lib/presolver.js index eaaaeef5b7..fcedc17e6b 100644 --- a/probot/presolver/lib/presolver.js +++ b/probot/presolver/lib/presolver.js @@ -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, diff --git a/probot/presolver/test/index.test.js b/probot/presolver/test/index.test.js index ea9c923284..1000973091 100644 --- a/probot/presolver/test/index.test.js +++ b/probot/presolver/test/index.test.js @@ -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: {