Skip to content

Commit 49409cd

Browse files
committed
test(signing): 🧪 Remove redundant tests for Get-PSBuildCertificate
* Removed tests that check for the existence and help documentation of `Get-PSBuildCertificate`. * Updated context descriptions to clarify platform-specific behavior. * Ensured tests are appropriately skipped on non-Windows platforms.
1 parent 4c77115 commit 49409cd

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

tests/Signing.tests.ps1

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,8 @@ Describe 'Code Signing Functions' {
1919
Remove-Item env:\CERTIFICATEPASSWORD -ErrorAction SilentlyContinue
2020
}
2121

22-
It 'Should exist and be exported' {
23-
Get-Command Get-PSBuildCertificate -Module PowerShellBuild -ErrorAction SilentlyContinue |
24-
Should -Not -BeNullOrEmpty
25-
}
26-
27-
It 'Has a SYNOPSIS section in the help' {
28-
(Get-Help Get-PSBuildCertificate).Synopsis |
29-
Should -Not -BeNullOrEmpty
30-
}
31-
32-
It 'Has at least one EXAMPLE section in the help' {
33-
(Get-Help Get-PSBuildCertificate).Examples.Example |
34-
Should -Not -BeNullOrEmpty
35-
}
36-
3722
Context 'Auto mode' {
38-
It 'Defaults to Auto mode when no CertificateSource is specified' {
23+
It 'Defaults to Auto mode when no CertificateSource is specified' -Skip:(-not $IsWindows) {
3924
Mock Get-ChildItem {}
4025
$VerboseOutput = Get-PSBuildCertificate -Verbose -ErrorAction SilentlyContinue 4>&1
4126
$VerboseOutput | Should -Match "CertificateSource is 'Auto'"
@@ -60,7 +45,8 @@ Describe 'Code Signing Functions' {
6045
}
6146
}
6247

63-
Context 'Store mode' {
48+
# Store mode only works on Windows
49+
Context 'Store mode' -Skip:(-not $IsWindows) {
6450
It 'Searches the certificate store for a valid code-signing certificate' -Skip:(-not $IsWindows) {
6551
# On Windows, we can test the actual logic without mocking the cert store itself
6652
# Instead, just verify the function accepts the parameter and attempts the search
@@ -510,7 +496,7 @@ Describe 'Code Signing Configuration' {
510496

511497
BeforeAll {
512498
# Load config once for all tests in this context
513-
BuildHelpers\Set-BuildEnvironment -Force -Path $script:moduleRoot
499+
# build.properties.ps1 will call Set-BuildEnvironment internally
514500
$script:config = & $script:buildPropertiesPath
515501
}
516502

0 commit comments

Comments
 (0)