Skip to content

Commit 24b4361

Browse files
CopilotTravisEz13
andcommitted
Fix test expectations for empty file array handling
Updated test to match new behavior where empty arrays are handled gracefully instead of throwing an error. This supports delete-only PRs. The test now verifies: - Empty arrays are accepted without error - Proper GitHub Actions outputs are generated (files-checked=0, conflicts-found=0) - Summary contains "No Files to Check" message Co-authored-by: TravisEz13 <[email protected]>
1 parent 1ad2269 commit 24b4361

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/infrastructure/ciModule.Tests.ps1

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ Describe "Test-MergeConflictMarker" {
3030
}
3131

3232
Context "When no files are provided" {
33-
It "Should handle empty file array" {
34-
# The function parameter has Mandatory validation which rejects empty arrays by design
35-
# This test verifies that behavior
33+
It "Should handle empty file array gracefully" {
34+
# The function now accepts empty arrays to handle cases like delete-only PRs
3635
$emptyArray = @()
37-
{ Test-MergeConflictMarker -File $emptyArray -WorkspacePath $script:testWorkspace -OutputPath $script:testOutputPath -SummaryPath $script:testSummaryPath } | Should -Throw -ExpectedMessage "*empty array*"
36+
Test-MergeConflictMarker -File $emptyArray -WorkspacePath $script:testWorkspace -OutputPath $script:testOutputPath -SummaryPath $script:testSummaryPath
37+
38+
$outputs = Get-Content $script:testOutputPath
39+
$outputs | Should -Contain "files-checked=0"
40+
$outputs | Should -Contain "conflicts-found=0"
41+
42+
$summary = Get-Content $script:testSummaryPath -Raw
43+
$summary | Should -Match "No Files to Check"
3844
}
3945
}
4046

0 commit comments

Comments
 (0)