Add some unit tests and integration tests, fix a new-pat arg issue - #266
Merged
Michael Smith (Exolun) merged 6 commits intoAug 12, 2024
Conversation
…ore test result file.
…tests. Added valid json files to allow real test-path validation.
Josh Wittner (jwittner)
requested changes
Aug 9, 2024
Josh Wittner (jwittner)
left a comment
Member
There was a problem hiding this comment.
A couple of small requests, but this is an AWESOME contribution to lay the foundation for improved testing!
Josh Wittner (jwittner)
approved these changes
Aug 9, 2024
Josh Wittner (jwittner)
left a comment
Member
There was a problem hiding this comment.
Updates look awesome! Only nit would be to ignore the TestResults.xml from any path so that we can run the script from anywhere.
Contributor
Author
Sounds good - since I will be OOF next week I think I'll merge this and create a branch withTestResults.xml change to gitignore for a fast-follow up. |
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 pull request includes a bunch of end to end tests and unit tests.
The end to end tests work by prompting the user to enter a series of Unity directories that exercise the test scenarios, and an azure subscription GUID to test the new AzureSubscription arg. It is by no means comprehensive, but it should more or less covers all of the valid happy paths. At the time of this PR there are 15 of these tests.
Similarly there is also a body of unit tests - these tests are mostly identical to the e2e tests except they use mocks heavily. Realistically the unit tests really don't test much because of how little of the underlying code actually runs. In fact, due to the support of
$PSCmdlet.ShouldProcess, I found it nigh-impossible to even mock/testUpdate-PackageAuthConfig, which is where most of the interesting code paths lie.Pester was fairly easy to work with, but I did find that the execution scope that the tests are run within makes it quite challenging to reuse code and do anything elaborate with the mocking - hence the lack of shared code across the two test files.