MCPcopy Create free account
hub / github.com/cli/cli / TestNewCmdCopilot

Function TestNewCmdCopilot

pkg/cmd/copilot/copilot_test.go:30–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNewCmdCopilot(t *testing.T) {
31 tests := []struct {
32 name string
33 args string
34 wantOpts CopilotOptions
35 wantErrString string
36 wantHelp bool
37 }{
38 {
39 name: "no argument",
40 args: "",
41 wantOpts: CopilotOptions{
42 CopilotArgs: []string{},
43 },
44 wantErrString: "",
45 },
46 {
47 name: "with arguments",
48 args: "some-arg some-other-arg",
49 wantOpts: CopilotOptions{
50 CopilotArgs: []string{"some-arg", "some-other-arg"},
51 },
52 },
53 {
54 name: "with --remove alone",
55 args: "--remove",
56 wantOpts: CopilotOptions{
57 Remove: true,
58 },
59 },
60 {
61 name: "with non-gh flags passed to copilot",
62 args: "-p testing --something-flag",
63 wantOpts: CopilotOptions{
64 CopilotArgs: []string{"-p", "testing", "--something-flag"},
65 },
66 },
67 {
68 name: "with --remove and arguments",
69 args: "--remove some-arg",
70 wantErrString: "cannot use --remove with args",
71 },
72 {
73 name: "with --remove passed to copilot using --",
74 args: "-- --remove",
75 wantOpts: CopilotOptions{
76 CopilotArgs: []string{"--remove"},
77 },
78 },
79 {
80 name: "with --remove and -- alone",
81 args: "--remove --",
82 wantOpts: CopilotOptions{
83 Remove: true,
84 },
85 },
86 {
87 name: "with --remove, some invalid arg, and --",

Callers

nothing calls this directly

Calls 3

NewCmdCopilotFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected