mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 08:02:07 +00:00
Add comprehensive test suite, fix minor issues, rename function and file names to match approved verbs (#708)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
BeforeAll {
|
||||
. (Join-Path $PSScriptRoot '..\Scripts\GUI\MainWindow-Deployment.ps1')
|
||||
. (Join-Path $PSScriptRoot '..\Scripts\GUI\Get-SystemUsesDarkMode.ps1')
|
||||
}
|
||||
|
||||
Describe 'Get-UndoFeatureLabel' {
|
||||
BeforeEach {
|
||||
$script:UndoFeatureLabelLookup = @{ DisableTelemetry = 'Enable telemetry' }
|
||||
$script:FeatureLabelLookup = @{ DisableTelemetry = 'Disable telemetry'; DisableWidgets = 'Disable widgets' }
|
||||
}
|
||||
|
||||
It 'prefers undo labels and falls back to feature labels' {
|
||||
Get-UndoFeatureLabel -FeatureId 'DisableTelemetry' | Should -Be 'Enable telemetry'
|
||||
Get-UndoFeatureLabel -FeatureId 'DisableWidgets' | Should -Be 'Disable widgets'
|
||||
}
|
||||
|
||||
It 'reads selected app IDs from string or array settings and removes blanks' {
|
||||
$stringSettings = [PSCustomObject]@{ Settings = @([PSCustomObject]@{ Name = 'Apps'; Value = ' One.App, ,Two.App ' }) }
|
||||
$arraySettings = [PSCustomObject]@{ Settings = @([PSCustomObject]@{ Name = 'Apps'; Value = @(' One.App ', '', 'Two.App') }) }
|
||||
|
||||
Get-SavedAppIdsFromSettingsJson -SettingsJson $stringSettings | Should -Be @('One.App', 'Two.App')
|
||||
Get-SavedAppIdsFromSettingsJson -SettingsJson $arraySettings | Should -Be @('One.App', 'Two.App')
|
||||
Get-SavedAppIdsFromSettingsJson -SettingsJson ([PSCustomObject]@{ Settings = @() }) | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'returns the AppsUseLightTheme registry preference and fails closed' {
|
||||
Mock Get-ItemProperty { [PSCustomObject]@{ AppsUseLightTheme = 0 } }
|
||||
Get-SystemUsesDarkMode | Should -BeTrue
|
||||
|
||||
Mock Get-ItemProperty { throw 'Registry unavailable' }
|
||||
Get-SystemUsesDarkMode | Should -BeFalse
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user