MCPcopy
hub / github.com/cli/cli / TestNewCmdFork

Function TestNewCmdFork

pkg/cmd/repo/fork/fork_test.go:27–195  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestNewCmdFork(t *testing.T) {
28 tests := []struct {
29 name string
30 cli string
31 tty bool
32 wants ForkOptions
33 wantErr bool
34 errMsg string
35 }{
36 {
37 name: "repo with git args",
38 cli: "foo/bar -- --foo=bar",
39 wants: ForkOptions{
40 Repository: "foo/bar",
41 GitArgs: []string{"--foo=bar"},
42 RemoteName: "origin",
43 Rename: true,
44 },
45 },
46 {
47 name: "git args without repo",
48 cli: "-- --foo bar",
49 wantErr: true,
50 errMsg: "repository argument required when passing git clone flags",
51 },
52 {
53 name: "repo",
54 cli: "foo/bar",
55 wants: ForkOptions{
56 Repository: "foo/bar",
57 RemoteName: "origin",
58 Rename: true,
59 GitArgs: []string{},
60 },
61 },
62 {
63 name: "blank remote name",
64 cli: "--remote --remote-name=''",
65 wantErr: true,
66 errMsg: "--remote-name cannot be blank",
67 },
68 {
69 name: "remote name",
70 cli: "--remote --remote-name=foo",
71 wants: ForkOptions{
72 RemoteName: "foo",
73 Rename: false,
74 Remote: true,
75 },
76 },
77 {
78 name: "blank nontty",
79 cli: "",
80 wants: ForkOptions{
81 RemoteName: "origin",
82 Rename: true,
83 Organization: "",
84 },

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
NewCmdForkFunction · 0.85
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected