mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 16:12:08 +00:00
Refactor feature management scripts to improve error handling
This commit is contained in:
@@ -27,6 +27,26 @@ Describe 'Invoke-SystemRestorePoint' {
|
||||
$script:CancelRequested | Should -BeFalse
|
||||
}
|
||||
|
||||
It 'returns false through the continuation flow when the System Restore state cannot be read' {
|
||||
Mock Get-ItemProperty { throw 'registry access denied' }
|
||||
Mock Read-Host { 'y' }
|
||||
|
||||
Invoke-SystemRestorePoint | Should -BeFalse
|
||||
|
||||
$script:CancelRequested | Should -BeFalse
|
||||
Should -Invoke Invoke-NonBlocking -Times 0 -Exactly
|
||||
}
|
||||
|
||||
It 'returns false without prompting when the System Restore state cannot be read in silent mode' {
|
||||
$script:Silent = $true
|
||||
Mock Get-ItemProperty { throw 'registry access denied' }
|
||||
|
||||
Invoke-SystemRestorePoint | Should -BeFalse
|
||||
|
||||
$script:CancelRequested | Should -BeFalse
|
||||
Should -Invoke Read-Host -Times 0 -Exactly
|
||||
}
|
||||
|
||||
It 'is loaded by the main entry point' {
|
||||
$entryPoint = Get-Content -LiteralPath (Join-Path $PSScriptRoot '..\Win11Debloat.ps1') -Raw
|
||||
$expectedImport = [regex]::Escape('Scripts/Features/Invoke-SystemRestorePoint.ps1')
|
||||
|
||||
Reference in New Issue
Block a user