mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix module specification hashtable in ModuleSpecification.Tests.ps1 (#7663)
This commit is contained in:
committed by
Travis Plunk
parent
d1991936c3
commit
3e06138692
@@ -228,19 +228,23 @@ Describe "ModuleSpecification objects and logic" -Tag "CI" {
|
||||
$testCases = @(
|
||||
@{
|
||||
TestName = "Version+RequiredVersion"
|
||||
ModuleSpecification = @{ Name = "BadVersionModule"; ModuleVersion = "3.1"; RequiredVersion = "3.1" }
|
||||
ModuleSpecification = @{ ModuleName = "BadVersionModule"; ModuleVersion = "3.1"; RequiredVersion = "3.1" }
|
||||
ErrorId = 'ArgumentException'
|
||||
},
|
||||
@{
|
||||
TestName = "NoName"
|
||||
ModuleSpecification = @{ ModuleVersion = "0.2" }
|
||||
ErrorId = 'MissingMemberException'
|
||||
},
|
||||
@{
|
||||
TestName = "BadField"
|
||||
ModuleSpecification = @{ Name = "StrangeFieldModule"; RequiredVersion = "7.4"; Duck = "1.2" }
|
||||
ModuleSpecification = @{ ModuleName = "StrangeFieldModule"; RequiredVersion = "7.4"; Duck = "1.2" }
|
||||
ErrorId = 'ArgumentException'
|
||||
},
|
||||
@{
|
||||
TestName = "BadType"
|
||||
ModuleSpecification = @{ Name = "BadTypeModule"; RequiredVersion = "Hello!" }
|
||||
ModuleSpecification = @{ ModuleName = "BadTypeModule"; RequiredVersion = "Hello!" }
|
||||
ErrorId = 'PSInvalidCastException'
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -252,7 +256,7 @@ Describe "ModuleSpecification objects and logic" -Tag "CI" {
|
||||
It "Cannot create from invalid module hashtables: <TestName>" -TestCases $testCases {
|
||||
param([string]$TestName, [hashtable]$ModuleSpecification)
|
||||
|
||||
{ [ModuleSpecification]::new($ModuleSpecification) } | Should -Throw
|
||||
{ [ModuleSpecification]::new($ModuleSpecification) } | Should -Throw -ErrorId $ErrorId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user