MCPcopy
hub / github.com/cli/cli / Test_NewCmdCreate

Function Test_NewCmdCreate

pkg/cmd/release/create/create_test.go:29–429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func Test_NewCmdCreate(t *testing.T) {
30 tempDir := t.TempDir()
31 tf, err := os.CreateTemp(tempDir, "release-create")
32 require.NoError(t, err)
33 fmt.Fprint(tf, "MY NOTES")
34 tf.Close()
35 af1, err := os.Create(filepath.Join(tempDir, "windows.zip"))
36 require.NoError(t, err)
37 af1.Close()
38 af2, err := os.Create(filepath.Join(tempDir, "linux.tgz"))
39 require.NoError(t, err)
40 af2.Close()
41
42 tests := []struct {
43 name string
44 args string
45 isTTY bool
46 stdin string
47 want CreateOptions
48 wantErr string
49 }{
50 {
51 name: "no arguments tty",
52 args: "",
53 isTTY: true,
54 want: CreateOptions{
55 TagName: "",
56 Target: "",
57 Name: "",
58 Body: "",
59 BodyProvided: false,
60 Draft: false,
61 Prerelease: false,
62 RepoOverride: "",
63 Concurrency: 5,
64 Assets: []*shared.AssetForUpload(nil),
65 VerifyTag: false,
66 FailOnNoCommits: false,
67 },
68 },
69 {
70 name: "no arguments notty",
71 args: "",
72 isTTY: false,
73 wantErr: "tag required when not running interactively",
74 },
75 {
76 name: "only tag name",
77 args: "v1.2.3",
78 isTTY: true,
79 want: CreateOptions{
80 TagName: "v1.2.3",
81 Target: "",
82 Name: "",
83 Body: "",
84 BodyProvided: false,
85 Draft: false,
86 Prerelease: false,

Callers

nothing calls this directly

Calls 12

TestFunction · 0.92
JoinMethod · 0.80
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
boolPtrFunction · 0.70
NewCmdCreateFunction · 0.70
CloseMethod · 0.65
CreateMethod · 0.65
NameMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected