Skip to content

Commit

Permalink
move tests
Browse files Browse the repository at this point in the history
james-garriss committed Jan 28, 2025
1 parent 70df10e commit 018c959
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions Testing/workflow/Initialize-ScubaGearForTesting.Tests.ps1
Original file line number Diff line number Diff line change
@@ -8,19 +8,38 @@ BeforeDiscovery {
# Source the function
. $PSScriptRoot/../../utils/workflow/Initialize-ScubaGearForTesting.ps1
# Initialize SG
$global:Outputs = Initialize-ScubaGearForTesting
$Outputs = Initialize-ScubaGearForTesting
foreach ($Output in $Outputs) {
$global:PSGallery = $false
$global:DownloadedOPAVersion = $false
$global:SetupTime = $false
$global:SetupTimeValue = 0
if ($Output.GetType().Name -eq "String") {
Write-Warning $Output
if ($Output.StartsWith("PSGallery is trusted")) {
$global:PSGallery = $true
}
elseif ($Output.StartsWith("Downloaded OPA version")) {
$global:DownloadedOPAVersion = $true
}
elseif ($Output.StartsWith("ScubaGear setup time elapsed")) {
$global:SetupTime = $true
$global:SetupTimeValue = [int]$Output.split(":")[1]
}
}
}
}

# Use Write-Warning b/c other writes don't actually write
Write-Output "Getting required modules..."
Write-Warning "Getting required modules..."
try {
. PowerShell\ScubaGear\RequiredVersions.ps1
}
catch {
throw "Unable to find RequiredVersions.ps1"
}
if ($ModuleList) {
Write-Output "Found list of modules!"
Write-Warning "Found list of modules!"
}
else {
Write-Warning 'Did NOT find list of modules!!'
@@ -37,26 +56,7 @@ Describe "PowerShell Modules Check" {
}

Describe "Initialize-ScubaGear Output Check" {
foreach ($Output in $global:Outputs) {
$global:PSGallery = $false
$global:DownloadedOPAVersion = $false
$global:SetupTime = $false
$global:SetupTimeValue = 0
if ($Output.GetType().Name -eq "String") {
Write-Warning $Output
if ($Output.StartsWith("PSGallery is trusted")) {
$global:PSGallery = $true
}
elseif ($Output.StartsWith("Downloaded OPA version")) {
$global:DownloadedOPAVersion = $true
}
elseif ($Output.StartsWith("ScubaGear setup time elapsed")) {
$global:SetupTime = $true
$global:SetupTimeValue = [int]$Output.split(":")[1]
}
}
}
It "PSGallery should be trust" {
It "PSGallery should be trusted" {
$global:PSGallery | Should -Be $true
}
It "OPA should be downloaded" {

0 comments on commit 018c959

Please sign in to comment.