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

Function TestNewValidateCommand

pkg/cli/validate_command_test.go:13–34  ·  view source on GitHub ↗

TestNewValidateCommand tests that the validate command is created correctly

(t *testing.T)

Source from the content-addressed store, hash-verified

11
12// TestNewValidateCommand tests that the validate command is created correctly
13func TestNewValidateCommand(t *testing.T) {
14 cmd := NewValidateCommand(func(string) error { return nil })
15
16 require.NotNil(t, cmd, "NewValidateCommand should return a non-nil command")
17 assert.Equal(t, "validate", cmd.Name(), "Command name should be 'validate'")
18 assert.NotEmpty(t, cmd.Short, "Command should have a short description")
19 assert.NotEmpty(t, cmd.Long, "Command should have a long description")
20
21 // Verify key flags exist
22 require.NotNil(t, cmd.Flags().Lookup("dir"), "validate command should have a --dir flag")
23 assert.Equal(t, "d", cmd.Flags().Lookup("dir").Shorthand, "--dir flag should have -d shorthand")
24 require.NotNil(t, cmd.Flags().Lookup("json"), "validate command should have a --json flag")
25 assert.Equal(t, "j", cmd.Flags().Lookup("json").Shorthand, "--json flag should have -j shorthand")
26 require.NotNil(t, cmd.Flags().Lookup("engine"), "validate command should have a --engine flag")
27 strictFlag := cmd.Flags().Lookup("strict")
28 require.NotNil(t, strictFlag, "validate command should have a --strict flag")
29 assert.Contains(t, strictFlag.Usage, "disallows write permissions and deprecated fields")
30 require.NotNil(t, cmd.Flags().Lookup("fail-fast"), "validate command should have a --fail-fast flag")
31 require.NotNil(t, cmd.Flags().Lookup("stats"), "validate command should have a --stats flag")
32 require.NotNil(t, cmd.Flags().Lookup("no-check-update"), "validate command should have a --no-check-update flag")
33 require.NotNil(t, cmd.Flags().Lookup("validate-images"), "validate command should have a --validate-images flag")
34}

Callers

nothing calls this directly

Calls 1

NewValidateCommandFunction · 0.85

Tested by

no test coverage detected