-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathGet-ModuleExtension.Tests.ps1
More file actions
41 lines (39 loc) · 1.83 KB
/
Copy pathGet-ModuleExtension.Tests.ps1
File metadata and controls
41 lines (39 loc) · 1.83 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
BeforeDiscovery {
if ($null -eq $env:BHProjectPath) {
$path = Join-Path -Path $PSScriptRoot -ChildPath '..\build.ps1'
. $path -Task Build
}
$global:manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
$outputDir = Join-Path -Path $env:BHProjectPath -ChildPath 'Output'
$outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName
$outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion
$outputModVerManifest = Join-Path -Path $outputModVerDir -ChildPath "$($env:BHProjectName).psd1"
Get-Module $env:BHProjectName | Remove-Module -Force -ErrorAction Ignore
Import-Module -Name $outputModVerManifest -Verbose:$false -ErrorAction Stop
}
Describe 'Get-PlasterManifestPathForCulture' {
InModuleScope $env:BHProjectName {
BeforeEach {
Mock Get-Module {
Import-Clixml $PSScriptRoot\Fixtures\ModuleList.xml
}
}
It 'Returns a list of modules' {
$extensions = Get-ModuleExtension -ModuleName "Plaster" -ModuleVersion '2.0.0' -ListAvailable
$extensions | Should -Not -BeNullOrEmpty
$extensions | Should -BeOfType 'PSCustomObject'
$extensions.Count | Should -Be 3
$extensions[0].Module | Should -Be "PSStucco"
$extensions[1].Module | Should -Be "PSStucco"
$extensions[2].Module | Should -Be "Sampler"
}
It 'Returns the latest' {
$extensions = Get-ModuleExtension -ModuleName "Plaster" -ModuleVersion '2.0.0'
$extensions | Should -Not -BeNullOrEmpty
$extensions | Should -BeOfType 'PSCustomObject'
$extensions.Count | Should -Be 2
$extensions[0].Module | Should -Be "PSStucco"
$extensions[1].Module | Should -Be "Sampler"
}
}
}