34 lines
991 B
PowerShell
34 lines
991 B
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 = ""
|
|
|
|
#region Test-IsPsModuleInstalled
|
|
|
|
Describe "Test-IsPsModuleInstalled" {
|
|
|
|
Context "When Module Exists" {
|
|
It "Returns True" {
|
|
|
|
Mock -ModuleName $moduleForMock Get-Module -MockWith {
|
|
return [PSCustomObject]@{ModuleType = "I am a fake module" }
|
|
}
|
|
|
|
Test-IsPsModuleInstalled FakeModule | Should Be $true
|
|
}
|
|
}
|
|
|
|
Context "When Module Does Not Exist" {
|
|
It "Returns False" {
|
|
|
|
Mock -ModuleName $moduleForMock Get-Module { return $null }
|
|
|
|
Test-IsPsModuleInstalled NonExistentModule | Should Be $false
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Test-IsPsModuleInstalled |