ps/Modules/Alkami.PowerShell.Common/Public/Format-Url.tests.ps1
2023-05-30 22:51:22 -07:00

45 lines
1.3 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 "Format-Url" {
Context "Potential Formats" {
$expectedValue = "my.fake.site.com"
It "Trims https://" {
$testString = "https://my.fake.site.com"
Format-Url $testString | Should -Be $expectedValue
}
It "Trims http://" {
$testString = "http://my.fake.site.com"
Format-Url $testString | Should -Be $expectedValue
}
It "Trims trailing forward slashes" {
$testString = "my.fake.site.com/"
Format-Url $testString | Should -Be $expectedValue
}
It "Trims Input Parameters" {
$testString = " https://my.fake.site.com/ "
Format-Url $testString | Should -Be $expectedValue
}
It "Doesn't Replace Leading H Values in Host" {
$testString = "http://hb-ip.cartercu.org/"
Format-Url $testString | Should -Be "hb-ip.cartercu.org"
}
}
}