Skip to content

Add tests for the PR subcommand#59

Closed
iainlane wants to merge 6 commits intoiainlane/testabilityfrom
iainlane/pr-tests
Closed

Add tests for the PR subcommand#59
iainlane wants to merge 6 commits intoiainlane/testabilityfrom
iainlane/pr-tests

Conversation

@iainlane
Copy link
Contributor

@iainlane iainlane commented Jun 28, 2023

This is part of a PR stack:

Some small refactoring to allow for it, nothing major.

iainlane added 6 commits June 27, 2023 12:21
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.
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.
@iainlane iainlane changed the title pr: Add testing Add tests for the PR subcommand Jun 28, 2023
@iainlane iainlane marked this pull request as ready for review June 28, 2023 15:58
@iainlane iainlane requested a review from a team as a code owner June 28, 2023 15:58
@iainlane iainlane force-pushed the iainlane/testability branch 2 times, most recently from 781f8e6 to 760880a Compare July 4, 2023 11:54
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
@iainlane iainlane deleted the branch iainlane/testability July 4, 2023 11:57
@iainlane iainlane closed this Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant