MCPcopy
hub / github.com/cli/cli / Test_deleteRun

Function Test_deleteRun

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

Source from the content-addressed store, hash-verified

107}
108
109func Test_deleteRun(t *testing.T) {
110 tests := []struct {
111 name string
112 isTTY bool
113 opts DeleteOptions
114 prompterStubs func(*prompter.PrompterMock)
115 runStubs func(*run.CommandStubber)
116 wantErr string
117 wantStdout string
118 wantStderr string
119 }{
120 {
121 name: "interactive confirm",
122 isTTY: true,
123 opts: DeleteOptions{
124 TagName: "v1.2.3",
125 },
126 wantStdout: "",
127 wantStderr: "✓ Deleted release v1.2.3\n! Note that the v1.2.3 git tag still remains in the repository\n",
128 prompterStubs: func(pm *prompter.PrompterMock) {
129 pm.ConfirmFunc = func(p string, d bool) (bool, error) {
130 if p == "Delete release v1.2.3 in OWNER/REPO?" {
131 return true, nil
132 }
133 return false, prompter.NoSuchPromptErr(p)
134 }
135 },
136 },
137 {
138 name: "skipping confirmation",
139 isTTY: true,
140 opts: DeleteOptions{
141 TagName: "v1.2.3",
142 SkipConfirm: true,
143 CleanupTag: false,
144 },
145 wantStdout: ``,
146 wantStderr: heredoc.Doc(`
147 ✓ Deleted release v1.2.3
148 ! Note that the v1.2.3 git tag still remains in the repository
149 `),
150 },
151 {
152 name: "non-interactive",
153 isTTY: false,
154 opts: DeleteOptions{
155 TagName: "v1.2.3",
156 SkipConfirm: false,
157 CleanupTag: false,
158 },
159 wantStdout: ``,
160 wantStderr: ``,
161 },
162 {
163 name: "cleanup-tag & skipping confirmation",
164 isTTY: true,
165 opts: DeleteOptions{
166 TagName: "v1.2.3",

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
NoSuchPromptErrFunction · 0.92
TestFunction · 0.92
StubFetchReleaseFunction · 0.92
RESTFunction · 0.92
StatusStringResponseFunction · 0.92
StubFunction · 0.92
FromFullNameFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected