TheJumpCloud / jcapi-powershell

MIT License
10 stars 3 forks source link

Sa 2319 pesterv5and mtp functions #47

Closed jworkmanjc closed 2 years ago

jworkmanjc commented 2 years ago

Issues

What does this solve?

Functions which cannot use the x-org-id header have been noted in the Module.cs file, these functions will have their orgID removed from the header before processing.

Added new MTP functions to the V2 module. MTP functions are now tested in the test-module step using tags. Pester Tests are validated for "Pester 5" compatibility.

Is there anything particularly tricky?

Somewhat, this PR changes every test moving forward and opens the door for tagging our pester tests individually. For this release ONLY the MTP tests were tagged. In a similar fashion to how we test the PowerShell module, the PowerShell SDK can be tested with exclude and include tags.

The /Tools/ValidateTests.ps1 script will display which tests are written, have valid tags and if they are Pester 5 compatible meaning that the autogenerated test has no code outside of a "beforeall" block. This check is managed with simple regex matching patterns. Moving forward we'll have to update new function tests to be Pester 5 compatible. Good news is that the VaildateTests function should tell us when a test is invalid and in bulk you can use the ValidateTests function to auto transform all tests to become Pester 5 Compatible using the "ReplacePesterBlock" & "ReplaceTags" parameters.

Screen Shot 2022-04-27 at 2 54 43 PM

The Following Functions have been added to the V2 Module:

How should this be tested?

Pull latest SDKs from CodeArtifact: JumpCloud.SDK.V2 - v0.0.32.202204281356 JumpCloud.SDK.V1 - v0.0.28.202204281355 JumpCloud.SDK.DirectoryInsights - v0.0.16.202204281355

The following functions should not throw an error when run:

Screenshots

MTP Specific Functions previous would display this error before this PR Screen Shot 2022-04-27 at 1 25 00 PM