ps/Modules/Alkami.PowerShell.Common/Public/Get-HostsFileContent.tests.ps1

33 lines
920 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
. $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 Get-HostsFileContent
Describe "Get-HostsFileContent" {
Context "When a bad path is supplied to Get-HostsFileContent" {
It "Writes a Warning" {
{
$tempPath = [System.IO.Path]::GetTempFileName()
((Get-HostsFileContent $tempPath) 3>&1) -match "Could not read hosts file from"
} | Should Be $true
}
}
Context "When default parameters are used" {
It "Returns Some Content" {
Get-HostsFileContent | Should Not Be $null
}
}
}
#endregion Get-HostsFileContent