mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-11-26 07:26:18 +01:00
refactor(tests): streamline test cases
This commit is contained in:
@@ -15,16 +15,23 @@ Describe 'Import-JsonFile' {
|
||||
$result.Name | Should -Be 'Example configuration'
|
||||
}
|
||||
|
||||
It 'parses the <Kind> settings fixture' -ForEach @(
|
||||
@{ Kind = 'default'; FileName = 'DefaultSettings.Valid.json' }
|
||||
@{ Kind = 'last-used'; FileName = 'LastUsedSettings.Valid.json' }
|
||||
) {
|
||||
$result = Import-JsonFile -filePath (Join-Path $script:FixturePath $FileName) -expectedVersion '1.0'
|
||||
It 'parses the default settings fixture' {
|
||||
$result = Import-JsonFile -filePath (Join-Path $script:FixturePath 'DefaultSettings.Valid.json') -expectedVersion '1.0'
|
||||
|
||||
$result.Settings | Should -Not -BeNullOrEmpty
|
||||
$result.Settings[0].Name | Should -Be 'Supported'
|
||||
}
|
||||
|
||||
It 'parses a single last-used setting and preserves its Boolean value' {
|
||||
$result = Import-JsonFile -filePath (Join-Path $script:FixturePath 'LastUsedSettings.Valid.json') -expectedVersion '1.0'
|
||||
|
||||
$result.Settings | Should -HaveCount 1
|
||||
$result.Settings[0].Name | Should -Be 'Supported'
|
||||
$result.Settings[0].Value | Should -BeOfType ([bool])
|
||||
$result.Settings[0].Value | Should -BeTrue
|
||||
Should -Invoke Write-Error -Times 0 -Exactly
|
||||
}
|
||||
|
||||
It 'returns null and reports an error for <Case>' -ForEach @(
|
||||
@{ Case = 'a version mismatch'; FileName = 'Config.VersionMismatch.json'; ExpectedVersion = '1.0'; Optional = $false; Error = 'version mismatch' }
|
||||
@{ Case = 'invalid JSON'; FileName = 'Config.Invalid.json'; ExpectedVersion = $null; Optional = $false; Error = 'Failed to parse JSON file' }
|
||||
|
||||
Reference in New Issue
Block a user