From 9f07da4ac67aa553a2a713fa3bd58b88ee62e34f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 14 Jul 2025 15:08:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B2=20[Test]:=20Add=20test=20for=20rem?= =?UTF-8?q?oving=20all=20contexts=20from=20VaultA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Context.Tests.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Context.Tests.ps1 b/tests/Context.Tests.ps1 index 2fe3667..3e9eda1 100644 --- a/tests/Context.Tests.ps1 +++ b/tests/Context.Tests.ps1 @@ -236,6 +236,22 @@ Describe 'Context' { { 'john_doe' | Remove-Context -Vault 'VaultA' } | Should -Not -Throw Get-Context -ID 'john_doe' -Vault 'VaultA' | Should -BeNullOrEmpty } + It 'Get-Context | Remove-Context - Should remove all contexts from VaultA' { + # Setup: Create multiple contexts in VaultA + Set-Context -ID 'TestContext1' -Context @{ Data = 'Test1' } -Vault 'VaultA' + Set-Context -ID 'TestContext2' -Context @{ Data = 'Test2' } -Vault 'VaultA' + Set-Context -ID 'TestContext3' -Context @{ Data = 'Test3' } -Vault 'VaultA' + + $contextsBefore = Get-Context -Vault 'VaultA' + $contextsBefore | Should -Not -BeNullOrEmpty + $contextsBefore.Count | Should -BeGreaterThan 0 + + { Get-Context | Remove-Context } | Should -Not -Throw + + # Verify all contexts are removed + $contextsAfter = Get-Context + $contextsAfter | Should -BeNullOrEmpty + } } Context 'Rename-Context' {