MCPcopy Index your code
hub / github.com/cli/cli / TestNewCmdInstall

Function TestNewCmdInstall

pkg/cmd/skills/install/install_test.go:30–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNewCmdInstall(t *testing.T) {
31 tests := []struct {
32 name string
33 cli string
34 wantOpts InstallOptions
35 wantLocalPath bool
36 wantErr bool
37 }{
38 {
39 name: "repo argument only",
40 cli: "monalisa/skills-repo",
41 wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", Scope: "project"},
42 },
43 {
44 name: "repo and skill",
45 cli: "monalisa/skills-repo git-commit",
46 wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", SkillName: "git-commit", Scope: "project"},
47 },
48 {
49 name: "repo and all flag",
50 cli: "monalisa/skills-repo --all",
51 wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", All: true, Scope: "project"},
52 },
53 {
54 name: "all flags",
55 cli: "monalisa/skills-repo git-commit --agent github-copilot --scope user --pin v1.0.0 --force",
56 wantOpts: InstallOptions{
57 SkillSource: "monalisa/skills-repo",
58 SkillName: "git-commit",
59 Agent: "github-copilot",
60 Scope: "user",
61 Pin: "v1.0.0",
62 Force: true,
63 },
64 },
65 {
66 name: "dir flag",
67 cli: "monalisa/skills-repo git-commit --dir ./custom-skills",
68 wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", SkillName: "git-commit", Dir: "./custom-skills", Scope: "project"},
69 },
70 {
71 name: "too many args",
72 cli: "a b c",
73 wantErr: true,
74 },
75 {
76 name: "invalid agent flag",
77 cli: "monalisa/skills-repo git-commit --agent nonexistent",
78 wantErr: true,
79 },
80 {
81 name: "pin conflicts with inline version",
82 cli: "monalisa/skills-repo git-commit@v1.0.0 --pin v2.0.0",
83 wantErr: true,
84 },
85 {
86 name: "all conflicts with skill name",
87 cli: "monalisa/skills-repo git-commit --all",

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
NewCmdInstallFunction · 0.85
EqualMethod · 0.80
ContainsMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected