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

38 lines
1.5 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-IsServiceManifestCore" {
$global:manifestCore = @"
<?xml version="1.0" encoding="utf-8"?>
<packageManifest>
<serviceManifest>
<runtime>_replaceME_</runtime>
</serviceManifest>
</packageManifest>
"@
Context "manifest is not null" {
It "runtime is dotnetcore" {
$manifest = $manifestCore.Replace("_replaceME_", "dotnetcore")
$packageManifest = (([xml]($manifest.Clone())).SelectNodes('//packageManifest'))
Test-IsServiceManifestCore -ServiceManifest $packageManifest | Should -BeTrue
}
It "runtime is core" {
$manifest = $manifestCore.Replace("_replaceME_", "core")
$packageManifest = (([xml]($manifest.Clone())).SelectNodes('//packageManifest'))
Test-IsServiceManifestCore -ServiceManifest $packageManifest | Should -BeTrue
}
It "runtime is not core" {
$manifest = $manifestCore.Replace("_replaceME_", "blarg")
$packageManifest = (([xml]($manifest.Clone())).SelectNodes('//packageManifest'))
Test-IsServiceManifestCore -ServiceManifest $packageManifest | Should -BeFalse
}
}
}