Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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$'
35 changes: 1 addition & 34 deletions tests/unit/PowerShell/system-maintenance.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Loading