refactor(tests): streamline test cases

This commit is contained in:
Jeffrey
2026-10-25 21:29:44 +01:00
parent 74648cbe26
commit 72ab1f348c
14 changed files with 75 additions and 94 deletions
+2 -22
View File
@@ -100,26 +100,6 @@ Describe 'Get-SelectedRegistryFeaturesForBackupValidation' {
}
}
Describe 'Test-RegistryValueKindNameSupported' {
It 'accepts supported registry value kind <KindName>' -ForEach @(
@{ KindName = 'dword' }
@{ KindName = 'QWord' }
@{ KindName = 'MultiString' }
) {
Test-RegistryValueKindNameSupported -KindName $KindName | Should -BeTrue
}
It 'rejects <Case>' -ForEach @(
@{ Case = 'a null kind name'; KindName = $null }
@{ Case = 'an empty kind name'; KindName = '' }
@{ Case = 'the Unknown registry kind'; KindName = 'Unknown' }
@{ Case = 'the unsupported None registry kind'; KindName = 'None' }
@{ Case = 'an invalid registry kind name'; KindName = 'NotARegistryValueKind' }
) {
Test-RegistryValueKindNameSupported -KindName $KindName | Should -BeFalse
}
}
Describe 'Test-RegistryValueDataMatchesKind' {
It 'accepts <Case>' -ForEach @(
@{ Case = 'the largest DWord'; Kind = 'DWord'; Data = [uint32]::MaxValue }
@@ -156,11 +136,11 @@ Describe 'Get-NormalizedRegistryValueName' {
}
Describe 'Test-RegistryValueKindNameSupported' {
It 'rejects unsupported kind <KindName>' -ForEach @('99', '-2', 'Unknown', 'None', '') {
It 'rejects unsupported kind <KindName>' -ForEach @('99', '-2', 'Unknown', 'None', '', $null, 'NotARegistryValueKind') {
Test-RegistryValueKindNameSupported -KindName $_ | Should -BeFalse
}
It 'accepts defined kind <KindName>' -ForEach @('String', 'expandstring', 'Binary', 'DWord', 'QWord', 'MultiString', '1') {
It 'accepts defined kind <KindName>' -ForEach @('String', 'expandstring', 'Binary', 'DWord', 'dword', 'QWord', 'MultiString', '1') {
Test-RegistryValueKindNameSupported -KindName $_ | Should -BeTrue
}
}