Skip to content

A comprehensive Windows security auditing and threat detection toolkit. Features 58 production-ready PowerShell functions organized into 14 modules for enterprise-grade security assessment, compliance validation, and incident response.

PowerShell

Smoke test: assert the new WhatIf rollback-preview contract (C6 fix) instead of the old no-rollback behavior

Okan YILDIZdd819f8b8d7a
diff --git a/tests/Smoke.Windows.Tests.ps1 b/tests/Smoke.Windows.Tests.ps1
index a7b9a17..d27c667 100644
--- a/tests/Smoke.Windows.Tests.ps1
+++ b/tests/Smoke.Windows.Tests.ps1
@@ -354,10 +354,12 @@ Describe 'WindowsSecurityAudit real-Windows smoke tests' -Tag @('Smoke', 'Window
$result = Invoke-SecurityRemediation -AssessmentPath $assessmentJson -GenerateRollback -WhatIf -RollbackDirectory $TestDrive
Assert-ResultShape -Object $result -Names @('RemediationDate', 'MaxSeverity', 'WhatIf', 'FindingsProcessed', 'Remediated', 'ManualReview', 'Failed', 'RollbackPath')
$result.WhatIf | Should -BeTrue
- # WhatIf: nothing may be applied and no rollback script may be written
+ # WhatIf: nothing may be applied; since v1.6.1 a rollback PREVIEW script is
+ # generated (README contract: preview fixes with a rollback script, no changes)
@($result.Remediated).Count | Should -Be 0
- $result.RollbackPath | Should -BeNullOrEmpty
- @(Get-ChildItem -Path $TestDrive -Filter 'SecurityRemediation_Rollback_*.ps1' -Recurse -ErrorAction SilentlyContinue).Count | Should -Be 0
+ $result.RollbackPath | Should -Not -BeNullOrEmpty
+ $result.RollbackPath | Should -Exist
+ (Get-Content -Path $result.RollbackPath -Raw) | Should -Match 'WHATIF PREVIEW'
}
It 'Update-DefenderConfiguration honors -WhatIf without changing the system' {