Add tests for the PR subcommand#59
Closed
iainlane wants to merge 6 commits intoiainlane/testabilityfrom
Closed
Conversation
In order to make the code testable one thing we need to do is eliminate the global state. That's what we do here. The handlers are turned into functions and they can have their own local state which they pass around.
Add a `Check` interface. This lets us separate out the part which is repeatedly called into their own functions. Then they'll be able to be tested.
Boilerplate removal
In an upcoming commit we will be testing the `ci` and `pr` subcommands. Splitting the interfaces into smaller components will make this a bit easier, since those testsuites will only have to fake what they need.
Now we've done all that refactoring, we can start to add more testcases sensibly. Actually, this particular commit would have been more or less possible already. Test the low-level github internal module. We've aimed for as close to 100% coverage as we can get, so there are a lot of cases.
Some small refactoring to allow for it, nothing major.
This was referenced Jun 28, 2023
Closed
Merged
781f8e6 to
760880a
Compare
An error occurred while trying to automatically change base from
iainlane/testability
to
main
July 4, 2023 11:55
An error occurred while trying to automatically change base from
iainlane/testability
to
main
July 4, 2023 11:55
An error occurred while trying to automatically change base from
iainlane/testability
to
main
July 4, 2023 11:56
An error occurred while trying to automatically change base from
iainlane/testability
to
main
July 4, 2023 11:56
An error occurred while trying to automatically change base from
iainlane/testability
to
main
July 4, 2023 11:56
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is part of a PR stack:
Some small refactoring to allow for it, nothing major.