-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid crashing when getting results for a missing branch
Bullet point in #46
- Loading branch information
Showing
12 changed files
with
256 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/fixtures/expected-outputs/result/result-output-missing-branch.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# wiby result command | ||
|
||
Overall status - pending | ||
|
||
## wiby-test/partial - success | ||
|
||
Checks: | ||
|
||
- partial_run - success | ||
- partial_run_2 - success | ||
|
||
## wiby-test/fail - test branch missing | ||
|
||
Checks: | ||
|
||
## wiby-test/pass - success | ||
|
||
Checks: | ||
|
||
- pass_run - success | ||
- pass_run_2 - success |
24 changes: 24 additions & 0 deletions
24
test/fixtures/expected-outputs/result/result-output-multiple-pass.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# wiby result command | ||
|
||
Overall status - success | ||
|
||
## wiby-test/partial - success | ||
|
||
Checks: | ||
|
||
- partial_run - success | ||
- partial_run_2 - success | ||
|
||
## wiby-test/fail - success | ||
|
||
Checks: | ||
|
||
- fail_run - success | ||
- fail_run_2 - success | ||
|
||
## wiby-test/pass - success | ||
|
||
Checks: | ||
|
||
- pass_run - success | ||
- pass_run_2 - success |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict' | ||
|
||
/** | ||
* Mocks of HTTP calls for "wiby result" command positive flow | ||
*/ | ||
const nock = require('nock') | ||
|
||
nock.disableNetConnect() | ||
|
||
nock('https://api.github.com') | ||
// get package json | ||
.post('/graphql') | ||
.times(3) | ||
.reply(200, { | ||
data: { | ||
repository: { | ||
object: { | ||
text: JSON.stringify({ | ||
dependencies: { | ||
wiby: '*' | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
}) | ||
.get('/repos/wiby-test/fakeRepo/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
.get('/repos/wiby-test/partial/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
.get('/repos/wiby-test/pass/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
.get('/repos/wiby-test/fail/branches/wiby-running-unit-tests') | ||
.reply(404, {}) | ||
// get check results | ||
.get('/repos/wiby-test/fakeRepo/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'fake_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'fake_run_2', conclusion: 'success' } | ||
] | ||
}) | ||
.get('/repos/wiby-test/fail/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'fail_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'fail_run_2', conclusion: 'success' } | ||
] | ||
}) | ||
.get('/repos/wiby-test/pass/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'pass_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'pass_run_2', conclusion: 'success' } | ||
] | ||
}) | ||
.get('/repos/wiby-test/partial/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'partial_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'partial_run_2', conclusion: 'success' } | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict' | ||
|
||
/** | ||
* Mocks of HTTP calls for "wiby result" command positive flow | ||
*/ | ||
const nock = require('nock') | ||
|
||
nock.disableNetConnect() | ||
|
||
nock('https://api.github.com') | ||
// get package json | ||
.post('/graphql') | ||
.times(3) | ||
.reply(200, { | ||
data: { | ||
repository: { | ||
object: { | ||
text: JSON.stringify({ | ||
dependencies: { | ||
wiby: '*' | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
}) | ||
.get('/repos/wiby-test/fakeRepo/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
.get('/repos/wiby-test/partial/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
.get('/repos/wiby-test/pass/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
.get('/repos/wiby-test/fail/branches/wiby-running-unit-tests') | ||
.reply(200, {}) | ||
// get check results | ||
.get('/repos/wiby-test/fakeRepo/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'fake_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'fake_run_2', conclusion: 'success' } | ||
] | ||
}) | ||
.get('/repos/wiby-test/fail/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'fail_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'fail_run_2', conclusion: 'success' } | ||
] | ||
}) | ||
.get('/repos/wiby-test/pass/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'pass_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'pass_run_2', conclusion: 'success' } | ||
] | ||
}) | ||
.get('/repos/wiby-test/partial/commits/wiby-running-unit-tests/check-runs') | ||
.reply(200, { | ||
check_runs: [ | ||
{ status: 'done', name: 'partial_run', conclusion: 'success' }, | ||
{ status: 'done', name: 'partial_run_2', conclusion: 'success' } | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters