test/dynamicparams/GetPlasterTemplateVarSet.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using module ..\.\TestRunnerSupportModule.psm1

Describe "Test GetPlasterTemplateVarSet" {
    BeforeAll {
        $TestSupportModule = [TestRunnerSupportModule]::new('MockModuleB')

        $AlicesTemplates = New-Item -Path (Join-Path $TestSupportModule.TestDrivePath "AlicesTemplates") -ItemType Directory
    
        Copy-Item -Path (Join-Path -Path $TestSupportModule.FixtureDirectoryPath -ChildPath 'resources\templates\NewScript') -Destination $AlicesTemplates -Recurse

        Set-Variable -Name MockNewScriptTemplatePath -Value $(Join-Path -Path $AlicesTemplates -ChildPath 'NewScript\plasterManifest_en-US.xml') -Scope Global
    }
    
    AfterAll {
        Remove-Variable -Name MockNewScriptTemplatePath -Scope Global
        $TestSupportModule.Teardown()
    }
    
    Context "Call with path to a plaster template file" {
        It "`$Result should have entries matching variable names" {
            InModuleScope PowerBolt {
                $Results = GetPlasterTemplateVarSet -Path $MockNewScriptTemplatePath
                $Results.Keys -Contains "ScriptCongruentPath" | Should -Be $true
                $Results.Keys -Contains "ScriptName" | Should -Be $true
            }
        }
    }
}