Skip to content

Commit 1631b4a

Browse files
committed
update tests
1 parent 94836b2 commit 1631b4a

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

eng/scripts/tests/test-get-aspire-cli-pr.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function Test-MissingArtifactsScenarios {
327327
$nonExistentPR = 999999
328328
$result = Invoke-TestCommand -Command $Script:ScriptPath -Arguments @("-PRNumber", $nonExistentPR, "-InstallPath", $testInstallDir, "-WhatIf") -ExpectedExitCode 1
329329

330-
if ($result.Success -and ($result.Output -match "Failed to get PR information" -or $result.Output -match "Could not retrieve HEAD SHA")) {
330+
if ($result.Success -and ($result.Output -match "Failed to get HEAD SHA" -or $result.Output -match "Could not retrieve HEAD SHA" -or $result.Output -match "Not Found")) {
331331
Write-TestResult "Non-existent PR number fails gracefully" "PASS"
332332
} else {
333333
Write-TestResult "Non-existent PR number fails gracefully" "FAIL" "Expected error message not found"
@@ -436,8 +436,9 @@ function Test-PRWithoutSuccessfulWorkflows {
436436

437437
if ($result.Success) {
438438
$expectedMessages = @(
439-
"Failed to get PR information",
439+
"Failed to get HEAD SHA",
440440
"Could not retrieve HEAD SHA",
441+
"Not Found",
441442
"does not exist",
442443
"don't have access"
443444
)

eng/scripts/tests/test-get-aspire-cli-pr.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ test_verbose_flag() {
8181
}
8282

8383
# Test: Short and long option equivalence
84-
test_option_equivalence() {
84+
test_option_equivalence_wrapper() {
8585
local test_cmd_short="$SCRIPT_UNDER_TEST $TEST_PR_NUMBER -i $TEST_INSTALL_DIR -r $TEST_RUN_ID -v -k --dry-run"
8686
local test_cmd_long="$SCRIPT_UNDER_TEST $TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --run-id $TEST_RUN_ID --verbose --keep-archive --dry-run"
8787

@@ -144,7 +144,7 @@ test_nuget_hive_path() {
144144
# Test: Large PR number validation (should fail for non-existent PR)
145145
test_large_pr_number() {
146146
local large_pr="999999999"
147-
run_test "Non-existent large PR numbers are properly rejected" "$SCRIPT_UNDER_TEST $large_pr --install-path $TEST_INSTALL_DIR --dry-run" 1 "Failed to get PR information" ""
147+
run_test "Non-existent large PR numbers are properly rejected" "$SCRIPT_UNDER_TEST $large_pr --install-path $TEST_INSTALL_DIR --dry-run" 1 "Failed to get HEAD SHA" ""
148148
}
149149

150150
# Test: Zero PR number rejection
@@ -193,7 +193,7 @@ run_all_tests() {
193193
test_dry_run_with_run_id
194194
test_dry_run_all_options
195195
test_verbose_flag
196-
test_option_equivalence
196+
test_option_equivalence_wrapper
197197
test_gh_dependency_check
198198
test_install_path_handling
199199

eng/scripts/tests/test-utils.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ function Test-HelpFunctionality {
607607
Invoke-Test $TestName {
608608
try {
609609
$helpOutput = & pwsh -Command "Get-Help '$ScriptPath'" 2>&1 | Out-String
610-
if ($helpOutput -and $helpOutput.Length -gt 0 -and ($helpOutput -match "SYNOPSIS" -or $helpOutput -match "DESCRIPTION")) {
610+
if ($helpOutput -and $helpOutput.Length -gt 0 -and ($helpOutput -match "SYNOPSIS" -or $helpOutput -match "DESCRIPTION" -or $helpOutput -match "NAME")) {
611611
Write-Output "Help functionality works: $helpOutput"
612612
return $helpOutput
613613
} else {
@@ -617,7 +617,7 @@ function Test-HelpFunctionality {
617617
catch {
618618
throw "Help functionality failed: $($_.Exception.Message)"
619619
}
620-
} 0 "SYNOPSIS|DESCRIPTION" ""
620+
} 0 "SYNOPSIS" ""
621621
}
622622

623623
<#
@@ -654,4 +654,5 @@ function Test-PlatformDetection {
654654
}
655655

656656
# Export all functions for dot-sourcing
657-
Export-ModuleMember -Function *
657+
# Note: Export-ModuleMember is only valid in modules, not when dot-sourcing
658+
# The functions are already available when dot-sourcing this script

0 commit comments

Comments
 (0)