(t *testing.T)
| 298 | } |
| 299 | |
| 300 | func TestAddCommandFlagDefaults(t *testing.T) { |
| 301 | cmd := NewAddCommand(validateEngineStub) |
| 302 | flags := cmd.Flags() |
| 303 | |
| 304 | tests := []struct { |
| 305 | flagName string |
| 306 | defaultValue string |
| 307 | }{ |
| 308 | {"name", ""}, |
| 309 | {"engine", ""}, |
| 310 | {"repo", ""}, |
| 311 | {"append", ""}, |
| 312 | {"dir", ""}, |
| 313 | {"stop-after", ""}, |
| 314 | } |
| 315 | |
| 316 | for _, tt := range tests { |
| 317 | t.Run(tt.flagName, func(t *testing.T) { |
| 318 | flag := flags.Lookup(tt.flagName) |
| 319 | require.NotNil(t, flag, "Flag should exist: %s", tt.flagName) |
| 320 | assert.Equal(t, tt.defaultValue, flag.DefValue, "Default value should match for flag: %s", tt.flagName) |
| 321 | }) |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | func TestAddCommandBooleanFlags(t *testing.T) { |
| 326 | cmd := NewAddCommand(validateEngineStub) |
nothing calls this directly
no test coverage detected