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

Function TestNewCmdList

pkg/cmd/skills/list/list_test.go:21–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestNewCmdList(t *testing.T) {
22 tests := []struct {
23 name string
24 cli string
25 wantOpts ListOptions
26 wantJSON bool
27 wantErr string
28 }{
29 {
30 name: "no flags",
31 cli: "",
32 wantOpts: ListOptions{},
33 },
34 {
35 name: "agent and scope filters",
36 cli: "--agent github-copilot --scope user",
37 wantOpts: ListOptions{
38 Agent: "github-copilot",
39 Scope: "user",
40 ScopeChanged: true,
41 },
42 },
43 {
44 name: "custom dir",
45 cli: "--dir ./skills",
46 wantOpts: ListOptions{
47 Dir: "./skills",
48 },
49 },
50 {
51 name: "json fields",
52 cli: "--json skillName,sourceURL,scope,version,pinned,path",
53 wantJSON: true,
54 },
55 {
56 name: "too many args",
57 cli: "extra",
58 wantErr: "unknown command",
59 },
60 {
61 name: "invalid agent",
62 cli: "--agent unknown",
63 wantErr: "invalid argument",
64 },
65 {
66 name: "invalid scope",
67 cli: "--scope org",
68 wantErr: "invalid argument",
69 },
70 {
71 name: "dir and agent are mutually exclusive",
72 cli: "--dir ./skills --agent github-copilot",
73 wantErr: "--dir and --agent cannot be used together",
74 },
75 {
76 name: "dir and scope are mutually exclusive",
77 cli: "--dir ./skills --scope user",
78 wantErr: "--dir and --scope cannot be used together",

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
ContainsMethod · 0.80
EqualMethod · 0.80
NewCmdListFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected