Skip to content

Commit

Permalink
Refactor test scripts to use parameterized path for settings file loa…
Browse files Browse the repository at this point in the history
…ding
  • Loading branch information
MariusStorhaug committed Feb 14, 2025
1 parent d1f4c18 commit bb9fbd0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
11 changes: 9 additions & 2 deletions tests/Advanced/Cars/Cars.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@

. "$PSScriptRoot\Cars.Settings.ps1"
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string] $Path
)

BeforeAll {
. $Path
}

Describe 'Cars Module Tests' {

Expand Down
18 changes: 8 additions & 10 deletions tests/Advanced/Planets/Planets.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<#
.SYNOPSIS
Pester tests for planet-related functions.
.DESCRIPTION
This script loads settings from Planets.Settings.ps1 and validates functions that return planet data.
.NOTES
Ensure that functions like Get-PlanetCount and Get-PlanetNames are available (e.g. from your module).
#>
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string] $Path
)

# Dot-source the settings file to import $PlanetsSettings
. "$PSScriptRoot\Planets.Settings.ps1"
BeforeAll {
. $Path
}

Describe 'Planets Module Tests' {

Expand Down

0 comments on commit bb9fbd0

Please sign in to comment.