Skip to content

Commit

Permalink
Be more explicit in Get-FinOpsToolkitVersion int test
Browse files Browse the repository at this point in the history
  • Loading branch information
flanakin committed Nov 29, 2023
1 parent 8290b71 commit 153154b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.

This file was deleted.

37 changes: 37 additions & 0 deletions src/powershell/Tests/Integration/Toolkit.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

& "$PSScriptRoot/../Initialize-Tests.ps1"

Describe 'Get-FinOpsToolkitVersion' {
It 'Should return all known releases' {
# Arrange
$expected = @('0.1.1', '0.1', '0.0.1')

# Act
$result = Get-FinOpsToolkitVersion

# Assert
$result.Count | Should -Be $expected.Count
$result | ForEach-Object {
$ver = $_.Version
$ver | Should -BeIn $expected -Because "version '$ver' should be added to the verification test"

# All versions
$_.Files.Name | Should -Contain "finops-hub-v$ver.zip"
$_.Files.Name | Should -Contain "optimization-workbook-v$ver.zip"
$_.Files.Name | Should -Contain "CostSummary.pbix"
$_.Files.Name | Should -Contain "CommitmentDiscounts.pbix"

# 0.1 and above
if ([version]$_.Version -ge [version]'0.1')
{
$_.Files.Name | Should -Contain "governance-workbook-v$ver.zip"
$_.Files.Name | Should -Contain "FOCUS.pbix"
$_.Files.Name | Should -Contain "PricingUnits.csv"
$_.Files.Name | Should -Contain "Regions.csv"
$_.Files.Name | Should -Contain "Services.csv"
}
}
}
}
2 changes: 1 addition & 1 deletion src/scripts/Test-PowerShell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ else
if ($Exports) { $testsToRun += '*-FinOpsCostExport*', 'CostExports.Tests.ps1' }
if ($FOCUS) { $testsToRun += '*-FinOpsSchema*', 'FOCUS.Tests.ps1' }
if ($Hubs) { $testsToRun += '*-FinOpsHub*', 'Hubs.Tests.ps1' }
if ($Toolkit) { $testsToRun += 'FinOpsToolkit.Tests.ps1' }
if ($Toolkit) { $testsToRun += 'FinOpsToolkit.Tests.ps1', '*-FinOpsToolkit*' }
if (-not $testsToRun) { $testsToRun = "*" }

Write-Host ''
Expand Down

0 comments on commit 153154b

Please sign in to comment.