Skip to content

Commit 3eab547

Browse files
Add test file
1 parent 83cbc28 commit 3eab547

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
5+
# Add Pester test to check the API for GroupPolicyEnforcement
6+
7+
Describe 'GroupPolicyEnforcement API Tests' {
8+
BeforeAll {
9+
# Setup code if needed
10+
}
11+
12+
AfterAll {
13+
# Cleanup code if needed
14+
}
15+
16+
It 'Should return the correct policy enforcement status' {
17+
18+
try {
19+
$expectedStatus = 'Disabled'
20+
$actualStatus = [Microsoft.PowerShell.PSResourceGet.Cmdlets.GroupPolicyRepositoryEnforcement]::IsGroupPolicyEnabled()
21+
$actualStatus | Should -Be $expectedStatus
22+
}
23+
finally {
24+
25+
}
26+
27+
}
28+
29+
It 'Should throw an error for invalid policy name' {
30+
# Arrange
31+
$invalidPolicyName = 'InvalidPolicy'
32+
33+
# Act & Assert
34+
{ Get-GroupPolicyEnforcementStatus -PolicyName $invalidPolicyName } | Should -Throw
35+
}
36+
37+
It 'Should return a list of all enforced policies' {
38+
# Act
39+
$policies = Get-AllEnforcedPolicies
40+
41+
# Assert
42+
$policies | Should -Not -BeNullOrEmpty
43+
$policies | Should -BeOfType 'System.Collections.Generic.List[System.String]'
44+
}
45+
}

0 commit comments

Comments
 (0)