Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 2f4ff13

Browse files
committed
Improve tests for multple module versions
1 parent 9029102 commit 2f4ff13

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Modules/OperationValidation/Test/OperationValidation.Tests.ps1

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ Describe "OperationValidation Module Tests" {
88
{
99
$env:psmodulepath += ";$moduleDir"
1010
}
11+
Remove-Module Microsoft.PowerShell.Operation.Validation -Force -ErrorAction SilentlyContinue
1112
Import-Module OperationValidation -Force
1213
$Commands = Get-Command -module OperationValidation|sort-object Name
1314
}
1415
AfterAll {
1516
$env:PSModulePath = $SavedModulePath
16-
remove-Module OperationValidation
17+
Remove-Module OperationValidation
1718
}
1819
It "Module has been loaded" {
1920
Get-Module OperationValidation | should not BeNullOrEmpty
@@ -86,13 +87,19 @@ Describe "OperationValidation Module Tests" {
8687
$tests.File | should be WindowsSearch.Simple.Tests.ps1
8788
}
8889
It "Can find a specific version of a module" {
89-
$tests = Get-OperationValidation -ModuleName 'VersionedModule' -Version '1.0.0'
90-
$tests.Count | Should be 1
91-
$tests.File | Should be 'PSGallery.Simple.Tests.ps1'
90+
$v1Tests = @(Get-OperationValidation -ModuleName 'VersionedModule' -Version '1.0.0')
91+
$v1Tests.Count | Should be 1
92+
$v1Tests.File | Should be 'PSGallery.Simple.Tests.ps1'
93+
94+
$v2Tests = @(Get-OperationValidation -ModuleName 'VersionedModule' -Version '2.0.0')
95+
$v2Tests.Count | Should be 2
96+
$v2Tests[0].File | Should be 'PSGallery.Simple.Tests.ps1'
97+
$v2Tests[1].File | Should be 'PSGallery.Simple.Tests.ps1'
9298
}
9399
It "Can get the latest version of a module if no version is specified" {
94100
$tests = Get-OperationValidation -ModuleName VersionedModule
95-
$tests.Version | Should be ([Version]'2.0.0')
101+
$tests[0].Version | Should be ([Version]'2.0.0')
102+
$tests[1].Version | Should be ([Version]'2.0.0')
96103
}
97104
It "Formats the output appropriately" {
98105
$output = Get-OperationValidation -modulename OperationValidation | out-string -str -width 210|?{$_}

0 commit comments

Comments
 (0)