-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve integration tests for pushing Jenkins statuses (#222)
* jenkins: refactor push-jenkins tests to prove they actually fail The previous approach of testing if network requests had been sent from the bot, via nock scopes, didn't test more then one network request. That's because we tested all scoped in a one-liner like this; ```js prCommitsScope.done() && scope.done() ``` It turns out that the above will not invoke the second `scope.done()`, meaning only the first nock scope (read: outgoing network request) was asserted. By going away from that one-liner and invoking one by one on each line, tests starts to explode. A fix to the bot's source will come in the next commit. * jenkins: wait until status has been pushed to GitHub before responding These changes are primarily done so we can get more reliable integration tests. Previously the incoming requests was responded to, before we knew whether or not the Jenkins status has been successfully pushed to GitHub. That makes it challenging to know when we can assert what we want to verify in integration tests, as we don't know when the entire operation has finished. Although the previous approach did what it should in practise when run in production, it should be just as important to have reliable tests that we can rely on when doing changes going forward. * jenkins: move HTTP assertions from .tearDown() alongside response test As it's way more intuitive to have those outgoing HTTP request assertions alongside other assertions, than as part of the test tear down process.
- Loading branch information
Showing
3 changed files
with
31 additions
and
18 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
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