MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestSearchJSONErrorWritesNoOutput

Function TestSearchJSONErrorWritesNoOutput

cmd/search_test.go:363–380  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

361}
362
363func TestSearchJSONErrorWritesNoOutput(t *testing.T) {
364 cmd, stdout := testSearchCmd()
365 setSearchOutputJSON(t, cmd)
366
367 mock := &mockFilesClient{
368 searchV2Fn: func(arg *files.SearchV2Arg) (*files.SearchV2Result, error) {
369 return nil, fmt.Errorf("search failed")
370 },
371 }
372 stubFilesClient(t, mock)
373
374 if err := search(cmd, []string{"report"}); err == nil {
375 t.Fatal("expected search error")
376 }
377 if got := stdout.String(); got != "" {
378 t.Fatalf("stdout = %q, want empty output on error", got)
379 }
380}
381
382func TestSearchCommandSupportsStructuredOutput(t *testing.T) {
383 if !commandSupportsStructuredOutput(searchCmd) {

Callers

nothing calls this directly

Calls 4

testSearchCmdFunction · 0.85
setSearchOutputJSONFunction · 0.85
stubFilesClientFunction · 0.85
searchFunction · 0.85

Tested by

no test coverage detected