MCPcopy Create free account
hub / github.com/algolia/cli / Test_runDeleteCmd

Function Test_runDeleteCmd

pkg/cmd/objects/delete/delete_test.go:126–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func Test_runDeleteCmd(t *testing.T) {
127 var testNbHits int32 = 2
128 tests := []struct {
129 name string
130 cli string
131 index string
132 objectIDs []string
133 nbHits *int32
134 exhaustiveNbHits bool
135 isTTY bool
136 wantOut string
137 }{
138 {
139 name: "single object-id, no TTY",
140 cli: "foo --object-ids 1 --confirm",
141 index: "foo",
142 objectIDs: []string{
143 "1",
144 },
145 isTTY: false,
146 wantOut: "",
147 },
148 {
149 name: "single object-id, TTY",
150 cli: "foo --object-ids 1 --confirm",
151 index: "foo",
152 objectIDs: []string{
153 "1",
154 },
155 isTTY: true,
156 wantOut: "✓ Successfully deleted exactly 1 object from foo\n",
157 },
158 {
159 name: "multiple object-ids, TTY",
160 cli: "foo --object-ids 1,2 --confirm",
161 index: "foo",
162 objectIDs: []string{
163 "1",
164 "2",
165 },
166 isTTY: true,
167 wantOut: "✓ Successfully deleted exactly 2 objects from foo\n",
168 },
169 {
170 name: "filters, TTY",
171 cli: "foo --filters 'foo:bar' --confirm",
172 index: "foo",
173 objectIDs: []string{},
174 nbHits: &testNbHits,
175 isTTY: true,
176 wantOut: "✓ Successfully deleted approximately 2 objects from foo\n",
177 },
178 {
179 name: "filters, TTY",
180 cli: "foo --filters 'foo:bar' --confirm",
181 index: "foo",
182 objectIDs: []string{},
183 nbHits: &testNbHits,

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
RESTFunction · 0.92
JSONResponseFunction · 0.92
NewFactoryFunction · 0.92
ExecuteFunction · 0.92
NewDeleteCmdFunction · 0.70
RunMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected