-
-
Notifications
You must be signed in to change notification settings - Fork 52
Add unit and routing tests for Halo API commands and improve coverage #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
466bc93
feat(tests): add unit tests for Invoke-HaloRequest with various scena…
homotechsual b433658
feat(tests): add routing tests for Get-Halo cmdlets in HaloAPI
homotechsual 76d02c4
feat(tests): add routing tests for Get-HaloProject, Get-HaloTemplate,…
homotechsual 569abf4
feat(tests): add routing tests for Get-HaloCustomField, Get-HaloDistr…
homotechsual 03a6cb0
feat(ci): increase minimum coverage threshold for Unit suite to 30%
homotechsual 1d5ce25
feat(tests): add unit tests for Invoke-HaloBatchItem to validate comm…
homotechsual 6f068dc
feat(ci): increase minimum coverage threshold for Unit suite to 35%
homotechsual db894fa
fix(workspace): remove unused folder reference for NinjaOne
homotechsual b3a3902
feat(tests): enhance Connect-HaloAPI tests for Key Vault integration …
homotechsual ec509a9
feat(tests): add tests for Connect-HaloAPI to validate Key Vault inte…
homotechsual f82da16
feat(ci): increase minimum coverage threshold for Unit suite to 40%
homotechsual 54c5b50
feat(tests): add routing tests for Get-HaloAction, Get-HaloField, Get…
homotechsual 0cfa3a3
feat(ci): increase minimum coverage threshold for Unit suite to 45%
homotechsual ddb4992
feat(ci): increase minimum coverage threshold for Unit suite to 50%
homotechsual 1212123
feat(ci): increase minimum coverage threshold for Unit suite to 50%
homotechsual 1d0b8d5
feat(ci): increase minimum coverage threshold for Unit suite to 55%
homotechsual 124456a
feat(ci): increase minimum coverage threshold for Unit suite to 60%
homotechsual cbecb89
feat(ci): update minimum coverage threshold for Unit suite to 63% and…
homotechsual c1615f6
feat(tests): add tests for Set-HaloSoftwareLicence and Set-HaloArticl…
homotechsual bbdafbb
feat(tests): add tests for New-HaloTicketType, New-HaloProject, New-H…
homotechsual d7cde84
feat(ci): increase minimum coverage threshold for Unit suite to 64%
homotechsual 7b78b18
feat(ci): increase minimum coverage threshold for Unit suite to 65%
homotechsual ab9d947
feat(tests): add tests for New-HaloCategory, New-HaloClient, New-Halo…
homotechsual ed13912
Refactor code structure for improved readability and maintainability
homotechsual 8cafc40
feat(tests): add tests for New-HaloFAQList, New-HaloInvoice, New-Halo…
homotechsual aab5040
feat(ci): increase minimum coverage threshold for Unit suite to 70%
homotechsual e0804e8
fix(New-HaloOpportunityBatch): correct parameter names for opportunit…
homotechsual 2da1788
fix(README): update HaloPSA Community Discord link
homotechsual 72a037f
feat(cspell): add cspell configuration file for spell checking
homotechsual b86aad3
feat(Get-HaloTicket): enhance pagination handling and add related tests
homotechsual a3093ee
chore: update version to 1.23.1 and document pagination fix in changelog
homotechsual File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # This file is generated by DevOps/Quality/Generate-CodecovComponents.ps1 | ||
| # Source of truth: DevOps/Quality/codecov-components-map.json | ||
| component_management: | ||
| individual_components: | ||
| - component_id: tickets | ||
| name: Tickets | ||
| paths: | ||
| - Public/**/*Ticket*.ps1 | ||
| - Private/**/*Ticket*.ps1 | ||
| - Classes/**/*Ticket*.psm1 | ||
| - component_id: actions | ||
| name: Actions | ||
| paths: | ||
| - Public/**/*Action*.ps1 | ||
| - Private/**/*Action*.ps1 | ||
| - Data/Templates/Action.json | ||
| - component_id: assets | ||
| name: Assets | ||
| paths: | ||
| - Public/**/*Asset*.ps1 | ||
| - Private/**/*Asset*.ps1 | ||
| - Data/Templates/Asset.json | ||
| - component_id: clients | ||
| name: Clients | ||
| paths: | ||
| - Public/**/*Client*.ps1 | ||
| - Public/**/*Site*.ps1 | ||
| - Public/**/*Supplier*.ps1 | ||
| - Data/Templates/Client.json | ||
| - Data/Templates/Site.json | ||
| - Data/Templates/Supplier.json | ||
| - component_id: billing | ||
| name: Billing | ||
| paths: | ||
| - Public/**/*Invoice*.ps1 | ||
| - Public/**/*Quote*.ps1 | ||
| - Public/**/*BillingTemplate*.ps1 | ||
| - Public/**/*SalesOrder*.ps1 | ||
| - Data/Templates/Invoice.json | ||
| - Data/Templates/Quote.json | ||
| - component_id: knowledge | ||
| name: Knowledge | ||
| paths: | ||
| - Public/**/*KB*.ps1 | ||
| - Public/**/*FAQ*.ps1 | ||
| - Public/**/*Article*.ps1 | ||
| - Data/Templates/KBArticle.json | ||
|
|
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,6 @@ Sign-Module.ps1 | |
| .artifacts/ | ||
| TestResults.xml | ||
| resource_mappings*.csv | ||
| test_output.txt | ||
| cmdlets.txt | ||
| tests_content.txt | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Generates the repository Codecov components configuration from a JSON map. | ||
| .DESCRIPTION | ||
| Produces .codecov.yml from DevOps/Quality/codecov-components-map.json. | ||
| When -Validate is provided, compares generated content to the checked-in | ||
| file and fails if drift is detected. | ||
| #> | ||
| [CmdletBinding()] | ||
| param( | ||
| [string]$MapPath, | ||
| [string]$OutputPath, | ||
| [switch]$Validate | ||
| ) | ||
|
|
||
| $repoRoot = Resolve-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath '..\..') | ||
|
|
||
| if (-not $MapPath) { | ||
| $MapPath = Join-Path -Path $PSScriptRoot -ChildPath 'codecov-components-map.json' | ||
| } | ||
| if (-not $OutputPath) { | ||
| $OutputPath = Join-Path -Path $repoRoot -ChildPath '.codecov.yml' | ||
| } | ||
|
|
||
| if (-not (Test-Path -Path $MapPath)) { | ||
| throw ('Codecov component map file not found: {0}' -f $MapPath) | ||
| } | ||
|
|
||
| $map = Get-Content -Path $MapPath -Raw | ConvertFrom-Json | ||
| if ($null -eq $map.components -or $map.components.Count -eq 0) { | ||
| throw 'Codecov component map does not contain any components.' | ||
| } | ||
|
|
||
| $generatedLines = @( | ||
| '# This file is generated by DevOps/Quality/Generate-CodecovComponents.ps1', | ||
| '# Source of truth: DevOps/Quality/codecov-components-map.json', | ||
| 'component_management:', | ||
| ' individual_components:' | ||
| ) | ||
|
|
||
| foreach ($component in $map.components) { | ||
| if ([string]::IsNullOrWhiteSpace($component.id)) { | ||
| throw 'A component id is missing in the map file.' | ||
| } | ||
| if ([string]::IsNullOrWhiteSpace($component.name)) { | ||
| throw ('Component ''{0}'' is missing a name in the map file.' -f $component.id) | ||
| } | ||
| if ($null -eq $component.paths -or $component.paths.Count -eq 0) { | ||
| throw ('Component ''{0}'' does not define any paths in the map file.' -f $component.id) | ||
| } | ||
|
|
||
| $generatedLines += (' - component_id: {0}' -f $component.id) | ||
| $generatedLines += (' name: {0}' -f $component.name) | ||
| $generatedLines += ' paths:' | ||
|
|
||
| foreach ($pathPattern in $component.paths) { | ||
| if ([string]::IsNullOrWhiteSpace($pathPattern)) { | ||
| continue | ||
| } | ||
| $generatedLines += (' - {0}' -f $pathPattern) | ||
| } | ||
| } | ||
|
|
||
| $generatedContent = ($generatedLines -join "`n") + "`n" | ||
|
|
||
| function Normalize-TextForComparison { | ||
| param( | ||
| [string]$Text | ||
| ) | ||
|
|
||
| if ($null -eq $Text) { | ||
| return '' | ||
| } | ||
|
|
||
| $normalized = $Text -replace "`r`n", "`n" | ||
| if ($normalized.Length -gt 0 -and $normalized[0] -eq [char]0xFEFF) { | ||
| $normalized = $normalized.Substring(1) | ||
| } | ||
|
|
||
| return $normalized.TrimEnd("`n") | ||
| } | ||
|
|
||
| if ($Validate) { | ||
| if (-not (Test-Path -Path $OutputPath)) { | ||
| throw ('Codecov config file is missing: {0}' -f $OutputPath) | ||
| } | ||
|
|
||
| $existingContent = Get-Content -Path $OutputPath -Raw | ||
| if ((Normalize-TextForComparison -Text $existingContent) -ne (Normalize-TextForComparison -Text $generatedContent)) { | ||
| throw 'Codecov component config drift detected. Run: pwsh -File .\DevOps\Quality\Generate-CodecovComponents.ps1' | ||
| } | ||
|
|
||
| Write-Host 'Codecov component config validation passed.' -ForegroundColor Green | ||
| return | ||
| } | ||
|
|
||
| Set-Content -Path $OutputPath -Value $generatedContent -Encoding utf8 | ||
| Write-Host ('Generated Codecov component config at: {0}' -f $OutputPath) -ForegroundColor Green |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { | ||
| "components": [ | ||
| { | ||
| "id": "tickets", | ||
| "name": "Tickets", | ||
| "paths": [ | ||
| "Public/**/*Ticket*.ps1", | ||
| "Private/**/*Ticket*.ps1", | ||
| "Classes/**/*Ticket*.psm1" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "actions", | ||
| "name": "Actions", | ||
| "paths": [ | ||
| "Public/**/*Action*.ps1", | ||
| "Private/**/*Action*.ps1", | ||
| "Data/Templates/Action.json" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "assets", | ||
| "name": "Assets", | ||
| "paths": [ | ||
| "Public/**/*Asset*.ps1", | ||
| "Private/**/*Asset*.ps1", | ||
| "Data/Templates/Asset.json" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "clients", | ||
| "name": "Clients", | ||
| "paths": [ | ||
| "Public/**/*Client*.ps1", | ||
| "Public/**/*Site*.ps1", | ||
| "Public/**/*Supplier*.ps1", | ||
| "Data/Templates/Client.json", | ||
| "Data/Templates/Site.json", | ||
| "Data/Templates/Supplier.json" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "billing", | ||
| "name": "Billing", | ||
| "paths": [ | ||
| "Public/**/*Invoice*.ps1", | ||
| "Public/**/*Quote*.ps1", | ||
| "Public/**/*BillingTemplate*.ps1", | ||
| "Public/**/*SalesOrder*.ps1", | ||
| "Data/Templates/Invoice.json", | ||
| "Data/Templates/Quote.json" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "knowledge", | ||
| "name": "Knowledge", | ||
| "paths": [ | ||
| "Public/**/*KB*.ps1", | ||
| "Public/**/*FAQ*.ps1", | ||
| "Public/**/*Article*.ps1", | ||
| "Data/Templates/KBArticle.json" | ||
| ] | ||
| } | ||
| ] | ||
| } |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The terminal auto-approve rule is still keyed to running unit tests with -MinimumCoveragePercent 20, but CI/docs in this PR raise the unit minimum to 70. Update this regex to match the new minimum (or remove it) so local runs align with CI expectations.