32 lines
1.4 KiB
PowerShell
32 lines
1.4 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-ShouldInstallExceptionService" {
|
|||
|
Context "No version content - Orb isn't installed or the version is wrong" {
|
|||
|
Mock -CommandName Get-OrbVersion -ModuleName $moduleForMock -MockWith { return $null }
|
|||
|
It "Throws on bad content (Not a version)" {
|
|||
|
# NOTE: v5 changes the Throw match to -like instead of substring
|
|||
|
# Updating to Pester v5 will require asterisks (*) around exception message match string
|
|||
|
{ Test-ShouldInstallExceptionService} | Should -Throw "ORB Version not found"
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
Context "Returns true for an early package value (expected)" {
|
|||
|
Mock -CommandName Get-OrbVersion -MockWith { return "2020.4.0.0" } -ModuleName $moduleForMock
|
|||
|
It "returns true" {
|
|||
|
( Test-ShouldInstallExceptionService) | Should -BeTrue
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
Context "Returns false for a latter package value (expected)" {
|
|||
|
Mock -CommandName Get-OrbVersion -ModuleName $moduleForMock -MockWith { "2020.5.0.1" }
|
|||
|
It "returns false" {
|
|||
|
(Test-ShouldInstallExceptionService) | Should -BeFalse
|
|||
|
}
|
|||
|
}
|
|||
|
}
|