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

Function Test_runDeleteCmd_dryRunJSON

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

Source from the content-addressed store, hash-verified

239}
240
241func Test_runDeleteCmd_dryRunJSON(t *testing.T) {
242 r := httpmock.Registry{}
243 r.Register(
244 httpmock.REST("GET", "1/indexes/foo/1"),
245 httpmock.JSONResponse(search.GetObjectsResponse{}),
246 )
247
248 f, out := test.NewFactory(false, &r, nil, "")
249 cmd := NewDeleteCmd(f, nil)
250 out, err := test.Execute(cmd, "foo --object-ids 1 --dry-run --output json", out)
251 if err != nil {
252 t.Fatal(err)
253 }
254
255 assert.Contains(t, out.String(), `"action":"delete_objects"`)
256 assert.Contains(t, out.String(), `"objectCount":1`)
257 assert.Contains(t, out.String(), `"dryRun":true`)
258}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected