From 5679831f52daa92551a8a3dff62135276ec7d683 Mon Sep 17 00:00:00 2001 From: Zach Trocinski Date: Tue, 11 Feb 2025 23:15:55 -0600 Subject: [PATCH] Add custom pester test --- .../pester/main.tests.ps1 | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 avm/ptn/mgmt-groups/subscription-placement/pester/main.tests.ps1 diff --git a/avm/ptn/mgmt-groups/subscription-placement/pester/main.tests.ps1 b/avm/ptn/mgmt-groups/subscription-placement/pester/main.tests.ps1 new file mode 100644 index 0000000000..85e78c98c6 --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/pester/main.tests.ps1 @@ -0,0 +1,31 @@ +param ( + [Parameter(Mandatory = $false)] + [hashtable] $TestInputData = @{} +) + +Describe 'Bicep Landing Zone (Sub) Vending Tests' { + + BeforeAll { + $subscriptionId = $TestInputData.DeploymentOutputs.createdSubId.Value + Update-AzConfig -DisplayBreakingChangeWarning $false + Select-AzSubscription -subscriptionId $subscriptionId + } + + Context 'Subscription Placement Tests' { + BeforeAll { + $subscriptionPlacementSummary = $TestInputData.DeploymentOutputs.subscriptionPlacementSummary.Value + } + + It 'Should have a Subscription Placement Summary' { + $subscriptionPlacementSummary | Should -Not -BeNullOrEmpty + } + + It 'Should contain the correct management group ID' { + $subscriptionPlacementSummary | Should -Contain 'test-mgmt-group' + } + + It 'Should contain the correct subscription ID' { + $subscriptionPlacementSummary | Should -Contain $subscriptionId + } + } +}