MCPcopy Create free account
hub / github.com/github/gh-aw / TestCreateWorkflowInteractively_WithForceFlag

Function TestCreateWorkflowInteractively_WithForceFlag

pkg/cli/interactive_test.go:447–482  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

445}
446
447func TestCreateWorkflowInteractively_WithForceFlag(t *testing.T) {
448 // This test verifies the force flag is passed through correctly
449 // We can't test the interactive UI, but we can verify the logic
450 // by checking error messages in CI environment
451
452 origTestMode := os.Getenv("GO_TEST_MODE")
453 origCI := os.Getenv("CI")
454
455 os.Setenv("GO_TEST_MODE", "true")
456
457 t.Cleanup(func() {
458 if origTestMode != "" {
459 os.Setenv("GO_TEST_MODE", origTestMode)
460 } else {
461 os.Unsetenv("GO_TEST_MODE")
462 }
463 if origCI != "" {
464 os.Setenv("CI", origCI)
465 } else {
466 os.Unsetenv("CI")
467 }
468 })
469
470 // Both with and without force should fail in CI
471 err1 := CreateWorkflowInteractively(context.Background(), "test-workflow", false, false)
472 err2 := CreateWorkflowInteractively(context.Background(), "test-workflow", false, true)
473
474 if err1 == nil || err2 == nil {
475 t.Error("Expected errors in CI environment")
476 }
477
478 // Both should have the same error since CI check happens first
479 if err1.Error() != err2.Error() {
480 t.Errorf("Expected same error for force=false and force=true in CI, got %q and %q", err1.Error(), err2.Error())
481 }
482}
483
484func TestInteractiveWorkflowBuilder_compileWorkflow_SpinnerIntegration(t *testing.T) {
485 // This test verifies that the spinner integration doesn't panic

Callers

nothing calls this directly

Calls 6

GetenvMethod · 0.80
SetenvMethod · 0.80
BackgroundMethod · 0.80
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected