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

Function TestNewCmdCopilot

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

Source from the content-addressed store, hash-verified

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