From 0fae32b05f2fdbe7a4597cb1a84ddd7aead4f012 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 18:46:31 +0100 Subject: [PATCH] Update tests to include secret removal and adjust context cleanup timing --- tests/Context.Tests.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Context.Tests.ps1 b/tests/Context.Tests.ps1 index 82a8377..d69b3a5 100644 --- a/tests/Context.Tests.ps1 +++ b/tests/Context.Tests.ps1 @@ -107,7 +107,9 @@ Describe 'Private functions' { } } #> - +BeforeAll { + Get-SecretInfo | Remove-Secret +} Describe 'Context' { Context 'Function: Set-Context' { It "Set-Context -ID 'TestID1'" { @@ -178,14 +180,14 @@ Describe 'Context' { } Context 'Function: Rename-Context' { - BeforeAll { + BeforeEach { # Ensure no contexts exist before starting tests Get-Context | ForEach-Object { Remove-Context -ID $_.ID } } - AfterAll { + AfterEach { # Cleanup any contexts created during tests Get-Context | ForEach-Object { Remove-Context -ID $_.ID