ps/Modules/Alkami.PowerShell.Configuration/Public/Test-AlkamiManifestGeneral10.tests.ps1
2023-05-30 22:51:22 -07:00

56 lines
1.6 KiB
PowerShell

. $PSScriptRoot\..\..\Load-PesterModules.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
$functionPath = Join-Path -Path $here -ChildPath $sut
Write-Host "Overriding SUT: $functionPath"
Import-Module $functionPath -Force
$moduleForMock = ""
Describe "Test-AlkamiManifestGeneral10" {
Context "Test valid manifest" {
$result = Test-AlkamiManifestGeneral10 @{
ComponentType = "Widget"
CreatorCode = "SRE"
Element = "Test"
ReleaseManagement = @{
alwaysDeploy = $false
}
BankIdentifiers = @(
@{
BankIdentifier = @{
# This is how XML files get read in as a tag value
'#text' = ([Guid]::NewGuid()).Guid
Name = "Testing Randomness"
}
}
)
}
It "Tested successfully" {
$result.success | Should -BeTrue
}
It "Produced no error messages" {
$result.results.Count | Should -Be 0
}
}
Context "Test invalid manifest" {
$result = Test-AlkamiManifestGeneral10 @{
ComponentType = "invalid"
}
It "Tested successfully" {
$result.success | Should -BeFalse
}
It "Actually produced warnings" {
$result.results | Should -Not -BeNullOrEmpty
}
It "Produced at least two warning statements" {
$result.results.Count | Should -BeGreaterOrEqual 2
}
}
}