Tests/Unit/Set-Vault.Tests.ps1
|
# Generated by tools\Build-PublicUnitTests.ps1. Re-run to regenerate. BeforeAll { $ProjectRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) $ModulePath = Join-Path $ProjectRoot 'GitEasy.psd1' } Describe 'Set-Vault (unit contract)' { BeforeAll { Remove-Module GitEasy -Force -ErrorAction SilentlyContinue Import-Module $ModulePath -Force } It 'is exported by the GitEasy module' { @(Get-Command -Module GitEasy -Name 'Set-Vault').Count | Should -Be 1 } It 'has CmdletBinding' { $cmd = Get-Command 'Set-Vault' $cmd.CmdletBinding | Should -Be $true } It 'supports ShouldProcess (-WhatIf and -Confirm available)' { $cmd = Get-Command 'Set-Vault' $cmd.Parameters.ContainsKey('WhatIf') | Should -Be $true $cmd.Parameters.ContainsKey('Confirm') | Should -Be $true } It 'declares the -Helper parameter' { $cmd = Get-Command 'Set-Vault' $cmd.Parameters.ContainsKey('Helper') | Should -Be $true } It '-Helper accepts only the documented values' { $cmd = Get-Command 'Set-Vault' $set = ($cmd.Parameters['Helper'].Attributes | Where-Object { $_.GetType().Name -eq 'ValidateSetAttribute' } | Select-Object -First 1).ValidValues $set -contains 'manager' | Should -Be $true $set -contains 'manager-core' | Should -Be $true $set -contains 'wincred' | Should -Be $true $set -contains 'cache' | Should -Be $true } It 'declares the -WriteIgnoreList parameter' { $cmd = Get-Command 'Set-Vault' $cmd.Parameters.ContainsKey('WriteIgnoreList') | Should -Be $true } It '-WriteIgnoreList is a switch parameter' { $cmd = Get-Command 'Set-Vault' $cmd.Parameters['WriteIgnoreList'].ParameterType.Name | Should -Be 'SwitchParameter' } It 'has a non-empty .SYNOPSIS' { $help = Get-Help 'Set-Vault' -ErrorAction SilentlyContinue $help.Synopsis | Should -Not -BeNullOrEmpty } It 'has at least one .EXAMPLE in CBH' { $help = Get-Help 'Set-Vault' -Full -ErrorAction SilentlyContinue @($help.examples.example).Count -gt 0 | Should -Be $true } } |