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

Function Test_NewCmdDelete

pkg/cmd/release/delete/delete_test.go:23–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func Test_NewCmdDelete(t *testing.T) {
24 tests := []struct {
25 name string
26 args string
27 isTTY bool
28 want DeleteOptions
29 wantErr string
30 }{
31 {
32 name: "version argument",
33 args: "v1.2.3",
34 isTTY: true,
35 want: DeleteOptions{
36 TagName: "v1.2.3",
37 SkipConfirm: false,
38 CleanupTag: false,
39 },
40 },
41 {
42 name: "skip confirm",
43 args: "v1.2.3 -y",
44 isTTY: true,
45 want: DeleteOptions{
46 TagName: "v1.2.3",
47 SkipConfirm: true,
48 CleanupTag: false,
49 },
50 },
51 {
52 name: "cleanup tag",
53 args: "v1.2.3 --cleanup-tag",
54 isTTY: true,
55 want: DeleteOptions{
56 TagName: "v1.2.3",
57 SkipConfirm: false,
58 CleanupTag: true,
59 },
60 },
61 {
62 name: "no arguments",
63 args: "",
64 isTTY: true,
65 wantErr: "accepts 1 arg(s), received 0",
66 },
67 }
68 for _, tt := range tests {
69 t.Run(tt.name, func(t *testing.T) {
70 ios, _, _, _ := iostreams.Test()
71 ios.SetStdoutTTY(tt.isTTY)
72 ios.SetStdinTTY(tt.isTTY)
73 ios.SetStderrTTY(tt.isTTY)
74
75 f := &cmdutil.Factory{
76 IOStreams: ios,
77 }
78
79 var opts *DeleteOptions
80 cmd := NewCmdDelete(f, func(o *DeleteOptions) error {

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
NewCmdDeleteFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected