Tests/Replace-RegExDynamicContent.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
. "$PSScriptRoot\CommonTestUtil.ps1"

Describe 'Replace-RegExDynamicContent' {
    Context 'When expanding template file content' {
        . $setup
        $configPath = "$PSScriptRoot\TestData\template_properties.json"

        $config = gc $configPath | ConvertFrom-Json | Convert-ObjectToHashtable
        $expansions = 0
        $val =Replace-RegExDynamicContent -Replacements $config.RegExDynamicReplacements  -Text "%build.vcs.number.RAPIDGate_SecureEmailDelivery_ComponentProjectTemplateVcsRoot%" -TotalExpansions ([ref]$expansions)
        Import-TemplateConfiguration -Path $configPath
        It 'can replace regex properly' {
            $val | Should Be '%build.vcs.number.RAPIDGatePlatform_ComponentProjectTemplate_ComponentProjectTemplateVcsRoot%'    
        }
    }
}