(t *testing.T)
| 23 | } |
| 24 | |
| 25 | func TestNewAddCommand(t *testing.T) { |
| 26 | cmd := NewAddCommand(validateEngineStub) |
| 27 | |
| 28 | require.NotNil(t, cmd, "NewAddCommand should not return nil") |
| 29 | assert.Equal(t, "add <workflow>...", cmd.Use, "Command use should be 'add <workflow>...'") |
| 30 | assert.Equal(t, "Add agentic workflows from repositories or local files to .github/workflows", cmd.Short, "Command short description should match") |
| 31 | assert.Contains(t, cmd.Long, "Add one or more agentic workflows", "Command long description should contain expected text") |
| 32 | |
| 33 | // Verify Args validator is set |
| 34 | assert.NotNil(t, cmd.Args, "Args validator should be set") |
| 35 | |
| 36 | // Verify flags are registered |
| 37 | flags := cmd.Flags() |
| 38 | |
| 39 | // Check name flag |
| 40 | nameFlag := flags.Lookup("name") |
| 41 | assert.NotNil(t, nameFlag, "Should have 'name' flag") |
| 42 | assert.Equal(t, "n", nameFlag.Shorthand, "Name flag shorthand should be 'n'") |
| 43 | |
| 44 | // Check engine flag |
| 45 | engineFlag := flags.Lookup("engine") |
| 46 | assert.NotNil(t, engineFlag, "Should have 'engine' flag") |
| 47 | |
| 48 | // Check repo flag |
| 49 | repoFlag := flags.Lookup("repo") |
| 50 | assert.NotNil(t, repoFlag, "Should have 'repo' flag") |
| 51 | assert.Equal(t, "r", repoFlag.Shorthand, "Repo flag shorthand should be 'r'") |
| 52 | |
| 53 | // Check PR flags |
| 54 | createPRFlag := flags.Lookup("create-pull-request") |
| 55 | assert.NotNil(t, createPRFlag, "Should have 'create-pull-request' flag") |
| 56 | prFlag := flags.Lookup("pr") |
| 57 | assert.NotNil(t, prFlag, "Should have 'pr' flag (alias)") |
| 58 | |
| 59 | // Check force flag |
| 60 | forceFlag := flags.Lookup("force") |
| 61 | assert.NotNil(t, forceFlag, "Should have 'force' flag") |
| 62 | |
| 63 | // Check append flag |
| 64 | appendFlag := flags.Lookup("append") |
| 65 | assert.NotNil(t, appendFlag, "Should have 'append' flag") |
| 66 | |
| 67 | // Check no-gitattributes flag |
| 68 | noGitattributesFlag := flags.Lookup("no-gitattributes") |
| 69 | assert.NotNil(t, noGitattributesFlag, "Should have 'no-gitattributes' flag") |
| 70 | |
| 71 | // Check dir flag |
| 72 | dirFlag := flags.Lookup("dir") |
| 73 | assert.NotNil(t, dirFlag, "Should have 'dir' flag") |
| 74 | assert.Equal(t, "d", dirFlag.Shorthand, "Dir flag shorthand should be 'd'") |
| 75 | |
| 76 | // Check no-stop-after flag |
| 77 | noStopAfterFlag := flags.Lookup("no-stop-after") |
| 78 | assert.NotNil(t, noStopAfterFlag, "Should have 'no-stop-after' flag") |
| 79 | |
| 80 | // Check stop-after flag |
| 81 | stopAfterFlag := flags.Lookup("stop-after") |
| 82 | assert.NotNil(t, stopAfterFlag, "Should have 'stop-after' flag") |
nothing calls this directly
no test coverage detected