MCPcopy Create free account
hub / github.com/cli/cli / Test_NewCmdDelete

Function Test_NewCmdDelete

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

Source from the content-addressed store, hash-verified

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