Skip to content

fix(cbh): add CBH coverage tests and resolve all 26 failures#66

Merged
jakehildreth merged 2 commits into
mainfrom
test/cbh-coverage-tests
May 13, 2026
Merged

fix(cbh): add CBH coverage tests and resolve all 26 failures#66
jakehildreth merged 2 commits into
mainfrom
test/cbh-coverage-tests

Conversation

@jakehildreth
Copy link
Copy Markdown
Owner

Summary

Adds a comprehensive automated Pester test suite that validates comment-based help (CBH) completeness for every function in Private/ and Public/, then fixes all 26 failures it discovered.

Changes

New Tests (Tests/Locksmith2.CBHCoverage.Tests.ps1)

511 tests across 6 Describe blocks:

  • CBH Synopsis — every function must have .SYNOPSIS
  • CBH Description — every function must have .DESCRIPTION
  • CBH Parameter Coverage — every param() variable must have a .PARAMETER doc
  • CBH No Phantom Parameters — no .PARAMETER doc for non-existent params
  • CBH Example — at least one .EXAMPLE required
  • CBH Outputs Coverage — if [OutputType] is declared, .OUTPUTS must be present

CBH Fixes

  • Private/UI/Show-Logo.ps1 — added full CBH to ConvertTo-ConsoleColor, Get-TrueColorFg, Get-TrueColorBg (all three had zero CBH)
  • Private/Convert/Convert-IdentityReferenceToSid.ps1 — replaced phantom .PARAMETER Principal/Credential/RootDSE with correct .PARAMETER IdentityReference
  • Private/Convert/Resolve-Principal.ps1 — removed phantom .PARAMETER Credential and .PARAMETER RootDSE
  • Private/Set/Set-DangerousEnrollee.ps1 — removed phantom .PARAMETER Credential and .PARAMETER RootDSE
  • Private/Set/Set-LowPrivilegeEnrollee.ps1 — removed phantom .PARAMETER Credential and .PARAMETER RootDSE
  • Private/Set/Set-CADisableExtensionList.ps1 — renamed .PARAMETER InputObject.PARAMETER AdcsObject
  • Public/Get-LS2Stores.ps1 — removed phantom .PARAMETER Name (function takes no parameters)
  • Public/Find-LS2VulnerableCA.ps1 — added .PARAMETER Forest/Credential/ExpandGroups/Rescan
  • Public/Find-LS2VulnerableObject.ps1 — added .PARAMETER Forest/Credential/ExpandGroups/Rescan
  • Public/Find-LS2VulnerableTemplate.ps1 — added .PARAMETER Forest/Credential/ExpandGroups/Rescan
  • Private/Get/Get-RootDSE.ps1 — added .PARAMETER Forest and .PARAMETER Credential
  • Private/Get/Get-WebEnrollmentEndpointStatus.ps1 — added .EXAMPLE
  • Private/Initialize/Initialize-LS2Scan.ps1 — added .EXAMPLE

Test Results

Tests Passed: 511, Failed: 0, Skipped: 0

- adds Tests/Locksmith2.CBHCoverage.Tests.ps1 with 6 Pester describes
- covers .SYNOPSIS, .DESCRIPTION, .PARAMETER coverage, phantom parameters,
  .EXAMPLE presence, and .OUTPUTS/.OutputType alignment
- uses PS AST parser + GetHelpContent() for accuracy; handles UTF-16LE BOM
- tags Unit + CBH; integrates with existing pester config filter
- 511 tests generated at discovery time; 26 genuine failures found on first run
- add CBH to Show-Logo.ps1 helpers (ConvertTo-ConsoleColor, Get-TrueColorFg, Get-TrueColorBg)
- fix phantom .PARAMETER docs in Convert-IdentityReferenceToSid, Resolve-Principal, Set-DangerousEnrollee, Set-LowPrivilegeEnrollee, Get-LS2Stores
- add missing .PARAMETER Forest/Credential/ExpandGroups/Rescan to Find-LS2Vulnerable* (CA, Object, Template)
- add missing .PARAMETER Forest/Credential to Get-RootDSE; rename InputObject->AdcsObject in Set-CADisableExtensionList
- add .EXAMPLE to Get-WebEnrollmentEndpointStatus and Initialize-LS2Scan
@jakehildreth jakehildreth merged commit 5dd06a4 into main May 13, 2026
1 check passed
@jakehildreth jakehildreth deleted the test/cbh-coverage-tests branch May 13, 2026 18:02
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