MCPcopy Index your code
hub / github.com/coder/coder / TestCommandHelp

Function TestCommandHelp

cli/root_test.go:31–102  ·  view source on GitHub ↗

nolint:tparallel,paralleltest

(t *testing.T)

Source from the content-addressed store, hash-verified

29
30//nolint:tparallel,paralleltest
31func TestCommandHelp(t *testing.T) {
32 // Test with AGPL commands
33 getCmds := func(t *testing.T) *serpent.Command {
34 // Must return a fresh instance of cmds each time.
35
36 t.Helper()
37 var root cli.RootCmd
38 rootCmd, err := root.Command(root.AGPL())
39 require.NoError(t, err)
40
41 return rootCmd
42 }
43 clitest.TestCommandHelp(t, getCmds, append(clitest.DefaultCases(),
44 clitest.CommandHelpCase{
45 Name: "coder agent --help",
46 Cmd: []string{"agent", "--help"},
47 },
48 clitest.CommandHelpCase{
49 Name: "coder list --output json",
50 Cmd: []string{"list", "--output", "json"},
51 },
52 clitest.CommandHelpCase{
53 Name: "coder users list --output json",
54 Cmd: []string{"users", "list", "--output", "json"},
55 },
56 clitest.CommandHelpCase{
57 Name: "coder users list",
58 Cmd: []string{"users", "list"},
59 },
60 clitest.CommandHelpCase{
61 Name: "coder provisioner list",
62 Cmd: []string{"provisioner", "list"},
63 },
64 clitest.CommandHelpCase{
65 Name: "coder provisioner list --output json",
66 Cmd: []string{"provisioner", "list", "--output", "json"},
67 },
68 clitest.CommandHelpCase{
69 Name: "coder provisioner jobs list",
70 Cmd: []string{"provisioner", "jobs", "list"},
71 },
72 clitest.CommandHelpCase{
73 Name: "coder provisioner jobs list --output json",
74 Cmd: []string{"provisioner", "jobs", "list", "--output", "json"},
75 },
76 // TODO (SasSwart): Remove these once the sync commands are promoted out of experimental.
77 clitest.CommandHelpCase{
78 Name: "coder exp sync --help",
79 Cmd: []string{"exp", "sync", "--help"},
80 },
81 clitest.CommandHelpCase{
82 Name: "coder exp sync ping --help",
83 Cmd: []string{"exp", "sync", "ping", "--help"},
84 },
85 clitest.CommandHelpCase{
86 Name: "coder exp sync start --help",
87 Cmd: []string{"exp", "sync", "start", "--help"},
88 },

Callers

nothing calls this directly

Calls 5

CommandMethod · 0.95
AGPLMethod · 0.95
TestCommandHelpFunction · 0.92
DefaultCasesFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected