@@ -84,13 +84,20 @@ if [ "$1" = "pr" ] && [ "$2" = "create" ]; then
8484 if [ "$3" = "--base" ] && [ "$5" = "--head" ] && [ "$7" = "--draft" ]; then
8585 base="$4"
8686 head="$6"
87- echo "Creating draft pull request for $head into $base in test/repo"
88- echo ""
87+ # Draft PR creation outputs the URL to stdout
8988 echo "https://github.com/test/repo/pull/999"
9089 exit 0
9190 fi
9291fi
9392
93+ if [ "$1" = "browse" ]; then
94+ # gh browse <PR_NUMBER> - simulate opening PR in browser
95+ if [ -n "$2" ]; then
96+ echo "Opening https://github.com/test/repo/pull/$2 in your browser."
97+ exit 0
98+ fi
99+ fi
100+
94101# Default error response
95102echo "Error: unknown gh command" >&2
96103exit 1
@@ -306,14 +313,13 @@ fn test_pr_command_with_draft_flag() {
306313 println ! ( "EXIT STATUS: {}" , output. status) ;
307314 println ! ( "======" ) ;
308315
309- // git-chain continues running even when individual PR creations fail
310- // but it should show the error from gh CLI and report failed PR creation
316+ // With the fix, draft PRs should now work successfully
311317 assert ! ( output. status. success( ) ,
312- "git-chain should complete successfully even when individual PRs fail " ) ;
313- assert ! ( stderr . contains( "the `--draft` flag is not supported with `--web` " ) ,
314- "Should show GitHub CLI error about incompatible flags , got: {}" , stderr ) ;
315- assert ! ( stdout. contains( "🛑 Failed to create PR for " ) ,
316- "Should show failed PR creation messages , got: {}" , stdout) ;
318+ "Command should succeed with draft flag " ) ;
319+ assert ! ( stdout . contains( "✅ Created PR for " ) ,
320+ "Should show successful PR creation , got: {}" , stdout ) ;
321+ assert ! ( stdout. contains( "🌐 Opened draft PR in browser" ) || stdout . contains ( "ℹ️ Draft PR created: ") ,
322+ "Should show browser opening or PR URL , got: {}" , stdout) ;
317323
318324 teardown_git_repo ( test_name) ;
319325}
@@ -364,7 +370,7 @@ fn test_gh_cli_not_installed() {
364370 println ! ( "EXIT STATUS: {}" , output. status) ;
365371 println ! ( "======" ) ;
366372
367- // Assertions
373+ // Assertions - the command should fail when gh is not installed
368374 assert ! ( !output. status. success( ) , "Command should fail when gh is not installed" ) ;
369375 assert ! ( stderr. contains( "GitHub CLI (gh) is not installed" ) ||
370376 stderr. contains( "not found in the PATH" ) ,
0 commit comments