Skip to content

Commit

Permalink
feat: raise PR
Browse files Browse the repository at this point in the history
rationalize repeated nock code block into a beforeEach clause.
  • Loading branch information
ghinks committed May 22, 2021
1 parent 4bf337b commit ba96374
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ tap.test('wiby.test()', async (tap) => {
const dependentOwner = 'pkgjs'
const dependentRepo = 'wiby'
const parentBranchName = 'main'
tap.test('test create PR when dependency feature branch does not exist in dependent repo', (t) => {
tap.beforeEach(() => {
nock('https://api.github.com')
.post('/repos/pkgjs/wiby/pulls')
.reply(201, {
Expand All @@ -119,6 +119,9 @@ tap.test('wiby.test()', async (tap) => {
}
}
})
})
tap.test('test create PR when dependency feature branch does not exist in dependent repo', (t) => {
nock('https://api.github.com')
.get(/repos/)
.reply(404, {})
wiby.test.createPR(dependentOwner, dependentRepo, parentBranchName)
Expand All @@ -129,20 +132,6 @@ tap.test('wiby.test()', async (tap) => {
})
tap.test('test create PR when dependency feature branch exists in dependent repo', (t) => {
nock('https://api.github.com')
.post('/repos/pkgjs/wiby/pulls')
.reply(201, {
html_url: htmlURL
})
.post(/graphql/)
.reply(200, {
data: {
repository: {
defaultBranchRef: {
name: 'main'
}
}
}
})
.get(/repos/)
.reply(200, {
name: parentBranchName
Expand Down

0 comments on commit ba96374

Please sign in to comment.