diff --git a/Tests/Integration/ASR.Integration.Tests.ps1 b/Tests/Integration/ASR.Integration.Tests.ps1 index 779936c..d51e766 100644 --- a/Tests/Integration/ASR.Integration.Tests.ps1 +++ b/Tests/Integration/ASR.Integration.Tests.ps1 @@ -2,7 +2,6 @@ Describe "ASR Integration Tests" { BeforeAll { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\ASR" $script:ManifestPath = Join-Path $script:ModulePath "ASR.psd1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -21,7 +20,7 @@ Describe "ASR Integration Tests" { } Context "DryRun Execution" { - It "Should run in DryRun mode without errors" -Skip:$script:IsCI { + It "Should run in DryRun mode without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires Windows Defender and admin rights { Invoke-ASRRules -DryRun -ErrorAction Stop } | Should -Not -Throw } diff --git a/Tests/Integration/AdvancedSecurity.Integration.Tests.ps1 b/Tests/Integration/AdvancedSecurity.Integration.Tests.ps1 index 789a74d..0f4d654 100644 --- a/Tests/Integration/AdvancedSecurity.Integration.Tests.ps1 +++ b/Tests/Integration/AdvancedSecurity.Integration.Tests.ps1 @@ -2,7 +2,6 @@ Describe "AdvancedSecurity Integration Tests" { BeforeAll { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\AdvancedSecurity" $script:ManifestPath = Join-Path $script:ModulePath "AdvancedSecurity.psd1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -48,24 +47,24 @@ Describe "AdvancedSecurity Integration Tests" { } Context "DryRun Execution" { - It "Should run Invoke-AdvancedSecurity in DryRun mode without errors" -Skip:$script:IsCI { + It "Should run Invoke-AdvancedSecurity in DryRun mode without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires admin rights and registry access { Invoke-AdvancedSecurity -DryRun -ErrorAction Stop } | Should -Not -Throw } - It "Should run with Balanced profile in DryRun mode" -Skip:$script:IsCI { + It "Should run with Balanced profile in DryRun mode" -Skip:($env:GITHUB_ACTIONS -eq 'true') { { Invoke-AdvancedSecurity -SecurityProfile "Balanced" -DryRun -ErrorAction Stop } | Should -Not -Throw } - It "Should run with Enterprise profile in DryRun mode" -Skip:$script:IsCI { + It "Should run with Enterprise profile in DryRun mode" -Skip:($env:GITHUB_ACTIONS -eq 'true') { { Invoke-AdvancedSecurity -SecurityProfile "Enterprise" -DryRun -ErrorAction Stop } | Should -Not -Throw } - It "Should run with Maximum profile in DryRun mode" -Skip:$script:IsCI { + It "Should run with Maximum profile in DryRun mode" -Skip:($env:GITHUB_ACTIONS -eq 'true') { { Invoke-AdvancedSecurity -SecurityProfile "Maximum" -DryRun -ErrorAction Stop } | Should -Not -Throw } - It "Should run Test-AdvancedSecurity without errors" -Skip:$script:IsCI { + It "Should run Test-AdvancedSecurity without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { { Test-AdvancedSecurity -ErrorAction Stop } | Should -Not -Throw } } diff --git a/Tests/Integration/AntiAI.Integration.Tests.ps1 b/Tests/Integration/AntiAI.Integration.Tests.ps1 index b13c023..0be71b8 100644 --- a/Tests/Integration/AntiAI.Integration.Tests.ps1 +++ b/Tests/Integration/AntiAI.Integration.Tests.ps1 @@ -3,7 +3,6 @@ Describe "AntiAI Integration Tests" { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\AntiAI" $script:ManifestPath = Join-Path $script:ModulePath "AntiAI.psd1" $script:ComplianceScript = Join-Path $script:ModulePath "Private\Test-AntiAICompliance.ps1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -26,14 +25,14 @@ Describe "AntiAI Integration Tests" { } Context "DryRun Execution" { - It "Should run in DryRun mode without errors" -Skip:$script:IsCI { + It "Should run in DryRun mode without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires admin rights and registry access { Invoke-AntiAI -DryRun -ErrorAction Stop } | Should -Not -Throw } } Context "Compliance Check" { - It "Should run compliance test without errors" -Skip:$script:IsCI { + It "Should run compliance test without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires admin rights and registry access { & $script:ComplianceScript -ErrorAction Stop } | Should -Not -Throw } diff --git a/Tests/Integration/DNS.Integration.Tests.ps1 b/Tests/Integration/DNS.Integration.Tests.ps1 index 94801be..332f21a 100644 --- a/Tests/Integration/DNS.Integration.Tests.ps1 +++ b/Tests/Integration/DNS.Integration.Tests.ps1 @@ -2,7 +2,6 @@ Describe "DNS Integration Tests" { BeforeAll { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\DNS" $script:ManifestPath = Join-Path $script:ModulePath "DNS.psd1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -26,7 +25,7 @@ Describe "DNS Integration Tests" { } Context "DryRun Execution" { - It "Should run in DryRun mode with provider specified without errors" -Skip:$script:IsCI { + It "Should run in DryRun mode with provider specified without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires network adapters and admin rights { Invoke-DNSConfiguration -Provider "Quad9" -DryRun -ErrorAction Stop } | Should -Not -Throw } diff --git a/Tests/Integration/EdgeHardening.Integration.Tests.ps1 b/Tests/Integration/EdgeHardening.Integration.Tests.ps1 index 444ac54..937170c 100644 --- a/Tests/Integration/EdgeHardening.Integration.Tests.ps1 +++ b/Tests/Integration/EdgeHardening.Integration.Tests.ps1 @@ -2,7 +2,6 @@ Describe "EdgeHardening Integration Tests" { BeforeAll { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\EdgeHardening" $script:ManifestPath = Join-Path $script:ModulePath "EdgeHardening.psd1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -38,12 +37,12 @@ Describe "EdgeHardening Integration Tests" { } Context "DryRun Execution" { - It "Should run Invoke-EdgeHardening in DryRun mode without errors" -Skip:$script:IsCI { + It "Should run Invoke-EdgeHardening in DryRun mode without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires admin rights and registry access { Invoke-EdgeHardening -DryRun -ErrorAction Stop } | Should -Not -Throw } - It "Should run Test-EdgeHardening without errors" -Skip:$script:IsCI { + It "Should run Test-EdgeHardening without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { { Test-EdgeHardening -ErrorAction Stop } | Should -Not -Throw } } diff --git a/Tests/Integration/Privacy.Integration.Tests.ps1 b/Tests/Integration/Privacy.Integration.Tests.ps1 index c6d85ff..49e71f8 100644 --- a/Tests/Integration/Privacy.Integration.Tests.ps1 +++ b/Tests/Integration/Privacy.Integration.Tests.ps1 @@ -2,7 +2,6 @@ Describe "Privacy Integration Tests" { BeforeAll { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\Privacy" $script:ManifestPath = Join-Path $script:ModulePath "Privacy.psd1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -21,7 +20,7 @@ Describe "Privacy Integration Tests" { } Context "DryRun Execution" { - It "Should run in DryRun mode with MSRecommended mode without errors" -Skip:$script:IsCI { + It "Should run in DryRun mode with MSRecommended mode without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires admin rights and registry access { Invoke-PrivacyHardening -Mode "MSRecommended" -DryRun -ErrorAction Stop } | Should -Not -Throw } diff --git a/Tests/Integration/SecurityBaseline.Integration.Tests.ps1 b/Tests/Integration/SecurityBaseline.Integration.Tests.ps1 index ff11da7..07b8307 100644 --- a/Tests/Integration/SecurityBaseline.Integration.Tests.ps1 +++ b/Tests/Integration/SecurityBaseline.Integration.Tests.ps1 @@ -2,7 +2,6 @@ Describe "SecurityBaseline Integration Tests" { BeforeAll { $script:ModulePath = Join-Path $PSScriptRoot "..\..\Modules\SecurityBaseline" $script:ManifestPath = Join-Path $script:ModulePath "SecurityBaseline.psd1" - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } Context "Module Structure" { @@ -26,7 +25,7 @@ Describe "SecurityBaseline Integration Tests" { } Context "DryRun Execution" { - It "Should run in DryRun mode without errors" -Skip:$script:IsCI { + It "Should run in DryRun mode without errors" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires admin rights and registry access { Invoke-SecurityBaseline -DryRun -ErrorAction Stop } | Should -Not -Throw } diff --git a/Tests/Unit/ModuleTemplate.Tests.ps1 b/Tests/Unit/ModuleTemplate.Tests.ps1 index 32b10ec..1616293 100644 --- a/Tests/Unit/ModuleTemplate.Tests.ps1 +++ b/Tests/Unit/ModuleTemplate.Tests.ps1 @@ -96,35 +96,34 @@ Describe "ModuleTemplate Module" { if (Get-Command Initialize-Logger -ErrorAction SilentlyContinue) { Initialize-Logger -EnableConsole $false } - $script:IsCI = $env:GITHUB_ACTIONS -eq 'true' -or $env:CI -eq 'true' } - It "Should execute without errors in DryRun mode" -Skip:$script:IsCI { + It "Should execute without errors in DryRun mode" -Skip:($env:GITHUB_ACTIONS -eq 'true') { # Skip on CI - requires initialized environment { Invoke-ModuleTemplate -DryRun } | Should -Not -Throw } - It "Should return a PSCustomObject" -Skip:$script:IsCI { + It "Should return a PSCustomObject" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result | Should -BeOfType [PSCustomObject] } - It "Should have ModuleName property" -Skip:$script:IsCI { + It "Should have ModuleName property" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result.ModuleName | Should -Be "ModuleTemplate" } - It "Should have Success property" -Skip:$script:IsCI { + It "Should have Success property" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result.PSObject.Properties.Name | Should -Contain 'Success' } - It "Should have ChangesApplied property" -Skip:$script:IsCI { + It "Should have ChangesApplied property" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result.PSObject.Properties.Name | Should -Contain 'ChangesApplied' } - It "Should not apply changes in DryRun mode" -Skip:$script:IsCI { + It "Should not apply changes in DryRun mode" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result.ChangesApplied | Should -Be 0 } @@ -132,7 +131,7 @@ Describe "ModuleTemplate Module" { Context "Return Object Structure" { - It "Should return object with all required properties" -Skip:$script:IsCI { + It "Should return object with all required properties" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $requiredProperties = @( @@ -150,12 +149,12 @@ Describe "ModuleTemplate Module" { } } - It "Errors should be an array" -Skip:$script:IsCI { + It "Errors should be an array" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result.Errors | Should -BeOfType [System.Object[]] } - It "Warnings should be an array" -Skip:$script:IsCI { + It "Warnings should be an array" -Skip:($env:GITHUB_ACTIONS -eq 'true') { $result = Invoke-ModuleTemplate -DryRun $result.Warnings | Should -BeOfType [System.Object[]] }