Skip to content

Commit

Permalink
feat: clean PR
Browse files Browse the repository at this point in the history
lint fixes
  • Loading branch information
ghinks committed Apr 18, 2021
1 parent b07d4a7 commit e143667
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/closePR.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ const gitURLParse = require('git-url-parse')
const debug = logger('wiby:closepr')

module.exports = async ({ dependents }) => {
const closedPrs = [];
const closedPrs = []
for (const { repository: url, pullRequest } of dependents) {
if (pullRequest) {
const dependentPkgInfo = gitURLParse(url)
const parentBranchName = await context.getParentBranchName()
const branch = await context.getTestingBranchName(parentBranchName)
const resp = await github.getChecks(dependentPkgInfo.owner, dependentPkgInfo.name, branch)
const closedPR = await closeDependencyPR(dependentPkgInfo.owner, dependentPkgInfo.name, branch, resp.data.check_runs)
if (!!closedPR) {
if (closedPR) {
closedPrs.push(closedPR)
}
}
}
return closedPrs;
return closedPrs
}

const closeDependencyPR = module.exports.closeDependencyPR = async function closeDependencyPR (owner, repo, branch, checkRuns) {
Expand Down
1 change: 0 additions & 1 deletion test/cli/closePR.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const gitFixture = require('../fixtures/git')
const childProcess = require('child_process')
const nock = require('nock')
const path = require('path')
const fs = require('fs')

const wibyCommand = path.join(__dirname, '..', '..', 'bin', 'wiby')
const fixturesPath = path.resolve(path.join(__dirname, '..', 'fixtures'))
Expand Down
12 changes: 6 additions & 6 deletions test/closePR.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ tap.test('close PR', (t) => {
})
t.test('closePR Cli function tests', (t) => {
t.plan(2)
t.test('closePR should not close PRs', async(t) => {
//nock setup
t.test('closePR should not close PRs', async (t) => {
// nock setup
nock('https://api.github.com')
.get(/repos.*check\-runs/)
.get(/repos.*check-runs/)
.reply(200, {
data: {}
})
Expand All @@ -82,12 +82,12 @@ tap.test('close PR', (t) => {

t.equal(result.length, 0)
})
t.test('closePR should close a single PR', async(t) => {
t.test('closePR should close a single PR', async (t) => {
gitFixture.init()
const branch = context.getTestingBranchName(await context.getParentBranchName())
//nock setup
// nock setup
nock('https://api.github.com')
.get(/repos.*check\-runs/)
.get(/repos.*check-runs/)
.reply(200, {
check_runs: [
{
Expand Down

0 comments on commit e143667

Please sign in to comment.