mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-11-26 07:26:18 +01:00
Refactor feature label handling to utilize language catalogs (#890)
This commit is contained in:
@@ -35,6 +35,7 @@ BeforeAll {
|
||||
$entry = @{}
|
||||
foreach ($field in 'ApplyText', 'UndoLabel', 'ApplyUndoText') {
|
||||
if ($null -ne $feature.$field) { $entry[$field] = [string]$feature.$field }
|
||||
$feature.PSObject.Properties.Remove($field)
|
||||
}
|
||||
$langFeatures[$featureId] = [PSCustomObject]$entry
|
||||
}
|
||||
@@ -112,7 +113,7 @@ Describe 'Invoke-FeatureApply' {
|
||||
It 'imports a registry-backed feature' {
|
||||
Invoke-FeatureApply -FeatureId 'RegistryFeature'
|
||||
|
||||
Should -Invoke Import-RegistryFile -Times 1 -Exactly -ParameterFilter { $path -eq 'feature.reg' }
|
||||
Should -Invoke Import-RegistryFile -Times 1 -Exactly -ParameterFilter { $path -eq 'feature.reg' -and $Message -eq '> Apply registry feature...' }
|
||||
Should -Invoke Remove-SelectedApps -Times 0 -Exactly
|
||||
}
|
||||
|
||||
@@ -352,6 +353,7 @@ Describe 'Invoke-FeatureUndo' {
|
||||
DisableTelemetry = [PSCustomObject]@{}
|
||||
DisableStoreSearchSuggestions = [PSCustomObject]@{}
|
||||
}
|
||||
Sync-TestLangFeatures
|
||||
Mock Set-StoreSearchSuggestionsEnabledForAllUsers { $true }
|
||||
Mock Set-StoreSearchSuggestionsEnabled { $true }
|
||||
Mock Get-StoreAppsDatabasePathForUser { 'store.db' }
|
||||
@@ -380,6 +382,12 @@ Describe 'Invoke-FeatureUndo' {
|
||||
$script:disabledFeatures | Should -Be @('Microsoft-Windows-Subsystem-Linux', 'VirtualMachinePlatform')
|
||||
}
|
||||
|
||||
It 'uses the language catalog for undo messages without display metadata' {
|
||||
Invoke-FeatureUndo -FeatureId 'EnableWindowsSandbox' | Should -BeTrue
|
||||
|
||||
Should -Invoke Write-Host -Times 1 -Exactly -ParameterFilter { $Object -eq '> Disable Sandbox...' }
|
||||
}
|
||||
|
||||
It 'disables Sandbox and re-enables telemetry tasks' {
|
||||
$script:Features.DisableTelemetry = [PSCustomObject]@{ ApplyUndoText = 'Enable telemetry'; RegistryUndoKey = 'enable-telemetry.reg' }
|
||||
Invoke-FeatureUndo -FeatureId 'EnableWindowsSandbox'
|
||||
|
||||
Reference in New Issue
Block a user