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

Function Test_deleteRun

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

Source from the content-addressed store, hash-verified

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