diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb44441..b4c273a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,5 +35,3 @@ repos: language: system types: [powershell] pass_filenames: false - # Exclude the test file itself from analysis for now - exclude: '^tests/unit/PowerShell/system-maintenance.Tests.ps1$' diff --git a/tests/unit/PowerShell/system-maintenance.Tests.ps1 b/tests/unit/PowerShell/system-maintenance.Tests.ps1 index 6a47279..b9c4645 100644 --- a/tests/unit/PowerShell/system-maintenance.Tests.ps1 +++ b/tests/unit/PowerShell/system-maintenance.Tests.ps1 @@ -27,40 +27,7 @@ Describe "system-maintenance.ps1" { Context "Execution Smoke Test" { It "should run without throwing errors with default parameters" { - & $scriptPath -WhatIf | Should -Not -Throw - } - } -} -# tests/unit/PowerShell/system-maintenance.Tests.ps1 - -BeforeAll { - # Suppress verbose output from the script itself during tests - $VerbosePreference = 'SilentlyContinue' - # Path to the script being tested - $scriptPath = "$PSScriptRoot/../../../PowerShell/system-administration/maintenance/system-maintenance.ps1" -} - -Describe "system-maintenance.ps1" { - Context "Basic Script Validation" { - It "should be a valid script file" { - Test-Path -Path $scriptPath | Should -Be $true - } - - It "should have comment-based help" { - $help = Get-Help -Path $scriptPath -ErrorAction SilentlyContinue - $help | Should -Not -BeNull - ($help.Name -eq 'system-maintenance') | Should -Be $true - } - - It "should support -WhatIf" { - $command = Get-Command -Path $scriptPath - $command.Parameters.Keys | Should -Contain 'WhatIf' - } - } - - Context "Execution Smoke Test" { - It "should run without throwing errors with default parameters" { - & $scriptPath -WhatIf | Should -Not -Throw + { & $scriptPath -WhatIf } | Should -Not -Throw } } }