Tests/Unit/Clear-Junk.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 'Clear-Junk (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 'Clear-Junk').Count | Should -Be 1 } It 'has CmdletBinding' { $cmd = Get-Command 'Clear-Junk' $cmd.CmdletBinding | Should -Be $true } It 'supports ShouldProcess (-WhatIf and -Confirm available)' { $cmd = Get-Command 'Clear-Junk' $cmd.Parameters.ContainsKey('WhatIf') | Should -Be $true $cmd.Parameters.ContainsKey('Confirm') | Should -Be $true } It 'declares the -Force parameter' { $cmd = Get-Command 'Clear-Junk' $cmd.Parameters.ContainsKey('Force') | Should -Be $true } It '-Force is a switch parameter' { $cmd = Get-Command 'Clear-Junk' $cmd.Parameters['Force'].ParameterType.Name | Should -Be 'SwitchParameter' } It 'declares the -Aggressive parameter' { $cmd = Get-Command 'Clear-Junk' $cmd.Parameters.ContainsKey('Aggressive') | Should -Be $true } It '-Aggressive is a switch parameter' { $cmd = Get-Command 'Clear-Junk' $cmd.Parameters['Aggressive'].ParameterType.Name | Should -Be 'SwitchParameter' } It 'declares the -LogPath parameter' { $cmd = Get-Command 'Clear-Junk' $cmd.Parameters.ContainsKey('LogPath') | Should -Be $true } It 'has a non-empty .SYNOPSIS' { $help = Get-Help 'Clear-Junk' -ErrorAction SilentlyContinue $help.Synopsis | Should -Not -BeNullOrEmpty } It 'has at least one .EXAMPLE in CBH' { $help = Get-Help 'Clear-Junk' -Full -ErrorAction SilentlyContinue @($help.examples.example).Count -gt 0 | Should -Be $true } } |