45 lines
1.3 KiB
PowerShell
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"
|
|
}
|
|
}
|
|
} |