MCPcopy
hub / github.com/cli/cli / TestNewCmdUnlink

Function TestNewCmdUnlink

pkg/cmd/project/unlink/unlink_test.go:18–184  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestNewCmdUnlink(t *testing.T) {
19 tests := []struct {
20 name string
21 cli string
22 wants unlinkOpts
23 wantsErr bool
24 wantsErrMsg string
25 wantsExporter bool
26 }{
27 {
28 name: "not-a-number",
29 cli: "x",
30 wantsErr: true,
31 wantsErrMsg: "invalid number: x",
32 },
33 {
34 name: "specify-repo-and-team",
35 cli: "--repo my-repo --team my-team",
36 wantsErr: true,
37 wantsErrMsg: "specify only one of `--repo` or `--team`",
38 },
39 {
40 name: "specify-nothing",
41 cli: "",
42 wants: unlinkOpts{
43 repo: "REPO",
44 owner: "OWNER",
45 },
46 },
47 {
48 name: "repo",
49 cli: "--repo my-repo",
50 wants: unlinkOpts{
51 repo: "my-repo",
52 },
53 },
54 {
55 name: "repo-flag-contains-owner",
56 cli: "--repo monalisa/my-repo",
57 wants: unlinkOpts{
58 owner: "monalisa",
59 repo: "my-repo",
60 },
61 },
62 {
63 name: "repo-flag-contains-owner-and-host",
64 cli: "--repo github.com/monalisa/my-repo",
65 wants: unlinkOpts{
66 host: "github.com",
67 owner: "monalisa",
68 repo: "my-repo",
69 },
70 },
71 {
72 name: "repo-flag-contains-wrong-format",
73 cli: "--repo h/e/l/l/o",
74 wantsErr: true,
75 wantsErrMsg: "expected the \"[HOST/]OWNER/REPO\" or \"REPO\" format, got \"h/e/l/l/o\"",

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
NewFunction · 0.92
NewCmdUnlinkFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected