(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestNewCmdPreview(t *testing.T) { |
| 25 | tests := []struct { |
| 26 | name string |
| 27 | input string |
| 28 | wantRepo string |
| 29 | wantSkillName string |
| 30 | wantVersion string |
| 31 | wantAllowHiddenDirs bool |
| 32 | wantErr bool |
| 33 | }{ |
| 34 | { |
| 35 | name: "repo and skill", |
| 36 | input: "github/awesome-copilot my-skill", |
| 37 | wantRepo: "github/awesome-copilot", |
| 38 | wantSkillName: "my-skill", |
| 39 | }, |
| 40 | { |
| 41 | name: "repo and skill with version", |
| 42 | input: "github/awesome-copilot my-skill@v1.2.0", |
| 43 | wantRepo: "github/awesome-copilot", |
| 44 | wantSkillName: "my-skill", |
| 45 | wantVersion: "v1.2.0", |
| 46 | }, |
| 47 | { |
| 48 | name: "repo and skill with SHA", |
| 49 | input: "github/awesome-copilot my-skill@abc123def456", |
| 50 | wantRepo: "github/awesome-copilot", |
| 51 | wantSkillName: "my-skill", |
| 52 | wantVersion: "abc123def456", |
| 53 | }, |
| 54 | { |
| 55 | name: "repo only", |
| 56 | input: "github/awesome-copilot", |
| 57 | wantRepo: "github/awesome-copilot", |
| 58 | }, |
| 59 | { |
| 60 | name: "no args", |
| 61 | input: "", |
| 62 | wantErr: true, |
| 63 | }, |
| 64 | { |
| 65 | name: "too many args", |
| 66 | input: "a b c", |
| 67 | wantErr: true, |
| 68 | }, |
| 69 | { |
| 70 | name: "allow-hidden-dirs flag", |
| 71 | input: "github/awesome-copilot my-skill --allow-hidden-dirs", |
| 72 | wantRepo: "github/awesome-copilot", |
| 73 | wantSkillName: "my-skill", |
| 74 | wantAllowHiddenDirs: true, |
| 75 | }, |
| 76 | } |
| 77 | |
| 78 | for _, tt := range tests { |
| 79 | t.Run(tt.name, func(t *testing.T) { |
| 80 | ios, _, _, _ := iostreams.Test() |
| 81 | f := &cmdutil.Factory{ |
nothing calls this directly
no test coverage detected