mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-03 18:55:33 +00:00
109dca657a
Skip-IfMissing skipped a test whenever the cmdlet under test was absent from the build, including the test asserting it exists. Every cmdlet compiles into one assembly, so there is no partial-build case for it to serve; all it did was hide a missing cmdlet. Delete the 37 copies and every call site, and drop the residual conditional skips in the same family (CmdExists probes, an attribute-presence skip in SdnCmdlets, a lifecycle helper skipping on a cmdlet-name collision fixed long ago). 894 It blocks only reflected [Cmdlet] and [Parameter] attributes back at the compiler: existence, CommandType -eq 'Cmdlet', Parameters.ContainsKey, IsMandatory reflection, and per-file CmdletsToExport asserts for whichever names an author remembered. Nothing reflected over the built assembly, so a new cmdlet missing from the manifest shipped invisible. One data-driven file replaces them: it diffs CmdletsToExport against the assembly's cmdlet types in both directions and asserts the conventions reflection can see. Behavioural tests are untouched: no-session errors, binding rejections, ShouldProcess and -WhatIf, ConfirmImpact, ValidateSet and ValidateRange values, parameter types, positions and pipeline binding. The generated help covered 169 of 194 cmdlets. Regenerated with the repo's own generate-help.ps1: 25 new markdown stubs, 13 existing docs picking up parameters added in earlier waves, and a rebuilt MAML. Co-authored-by: goodolclint-claude[bot] <323206664+goodolclint-claude[bot]@users.noreply.github.com>
58 lines
1.8 KiB
PowerShell
58 lines
1.8 KiB
PowerShell
#Requires -Module Pester
|
|
<#
|
|
.SYNOPSIS
|
|
Pester 5 tests for Test-PveConnection.
|
|
All tests are fully offline — no live Proxmox VE target is required.
|
|
#>
|
|
|
|
BeforeAll {
|
|
. $PSScriptRoot/../_TestHelper.ps1
|
|
}
|
|
|
|
Describe 'Test-PveConnection' {
|
|
Context 'Parameter metadata' {
|
|
BeforeAll {
|
|
$script:Cmd = Get-Command 'Test-PveConnection'
|
|
}
|
|
|
|
It 'Should have a Detailed switch parameter' {
|
|
$script:Cmd.Parameters.ContainsKey('Detailed') | Should -BeTrue
|
|
$script:Cmd.Parameters['Detailed'].ParameterType |
|
|
Should -Be ([System.Management.Automation.SwitchParameter])
|
|
}
|
|
|
|
It 'Detailed should not be Mandatory' {
|
|
$detailed = $script:Cmd.Parameters['Detailed']
|
|
$isMandatory = $detailed.ParameterSets.Values | Where-Object { $_.IsMandatory }
|
|
$isMandatory | Should -BeNullOrEmpty
|
|
}
|
|
}
|
|
|
|
Context 'Behaviour without an active session' {
|
|
It 'Should return $false when no session is active (default mode)' {
|
|
$result = Test-PveConnection
|
|
$result | Should -BeFalse
|
|
}
|
|
|
|
It 'Should return nothing when -Detailed is specified and no session is active' {
|
|
$result = Test-PveConnection -Detailed
|
|
$result | Should -BeNullOrEmpty
|
|
}
|
|
|
|
It 'Should not throw when called with no arguments and no session' {
|
|
{ Test-PveConnection -ErrorAction Stop } | Should -Not -Throw
|
|
}
|
|
|
|
It 'Should not throw when called with -Detailed and no session' {
|
|
{ Test-PveConnection -Detailed -ErrorAction Stop } | Should -Not -Throw
|
|
}
|
|
}
|
|
|
|
Context 'Output type contract' {
|
|
It 'Default output is a boolean' {
|
|
$result = Test-PveConnection
|
|
$result | Should -BeOfType [bool]
|
|
}
|
|
}
|
|
}
|