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

Function TestNewSecretsCommand

pkg/cli/secrets_command_test.go:14–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestNewSecretsCommand(t *testing.T) {
15 cmd := NewSecretsCommand()
16
17 require.NotNil(t, cmd, "NewSecretsCommand should not return nil")
18 assert.Equal(t, "secrets", cmd.Use, "Command use should be 'secrets'")
19 assert.Equal(t, "Manage GitHub Actions secrets for agentic workflows", cmd.Short, "Command short description should match")
20 assert.Contains(t, cmd.Long, "Manage GitHub Actions secrets", "Command long description should contain expected text")
21 assert.Contains(t, cmd.Long, "for agentic workflows", "Command long description should use lowercase product phrasing")
22 assert.NotContains(t, cmd.Long, "GitHub Agentic Workflows", "Command long description should avoid inconsistent capitalization")
23
24 // Verify subcommands are added
25 assert.True(t, cmd.HasSubCommands(), "Secrets command should have subcommands")
26 subcommands := cmd.Commands()
27 assert.GreaterOrEqual(t, len(subcommands), 2, "Should have at least 2 subcommands (set, bootstrap)")
28
29 // Verify specific subcommands exist
30 var hasSetSubcommand, hasBootstrapSubcommand bool
31 for _, subcmd := range subcommands {
32 if subcmd.Use == "set <secret-name>" || subcmd.Name() == "set" {
33 hasSetSubcommand = true
34 }
35 if subcmd.Use == "bootstrap" || subcmd.Name() == "bootstrap" {
36 hasBootstrapSubcommand = true
37 }
38 }
39 assert.True(t, hasSetSubcommand, "Should have 'set' subcommand")
40 assert.True(t, hasBootstrapSubcommand, "Should have 'bootstrap' subcommand")
41}
42
43func TestSecretsCommandHelp(t *testing.T) {
44 cmd := NewSecretsCommand()

Callers

nothing calls this directly

Calls 1

NewSecretsCommandFunction · 0.85

Tested by

no test coverage detected