Skip to content

Commit

Permalink
remove mock and add temp file instead
Browse files Browse the repository at this point in the history
  • Loading branch information
hjorslev committed Apr 11, 2024
1 parent 4ec16b7 commit ceb0cba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Tests/Unit/Private/Test-SteamAPIKey.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
Describe 'Test-SteamAPIKey Tests' {
Context 'When the Steam API key file exists' {
BeforeAll {
Mock -CommandName Test-Path -ModuleName SteamPS -MockWith { $true }
# Create a dummy SteamPSKey.json file
$SteamPSKeyLocation = "$env:AppData\SteamPS\SteamPSKey.json"
New-Item -Path $SteamPSKeyLocation -ItemType File -Force
}
AfterAll {
# Remove the dummy SteamPSKey.json file
Remove-Item -Path "$env:AppData\SteamPS\SteamPSKey.json" -Force
}

It 'Returns $true' {
$result = Test-SteamAPIKey
$result | Should -BeOfType [bool]
Expand All @@ -15,9 +22,6 @@ Describe 'Test-SteamAPIKey Tests' {
}

Context 'When the Steam API key file does not exist' {
BeforeAll {
Mock -CommandName Test-Path -ModuleName SteamPS -MockWith { $false }
}
It 'Returns $false' {
$result = Test-SteamAPIKey
$result | Should -BeOfType [bool]
Expand Down

0 comments on commit ceb0cba

Please sign in to comment.