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

Function TestLsJSONErrorWritesNoOutput

cmd/ls_test.go:640–656  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

638}
639
640func TestLsJSONErrorWritesNoOutput(t *testing.T) {
641 cmd, stdout := testLsCmd(t)
642 setLsOutputJSON(t, cmd)
643 mock := &mockFilesClient{
644 listFolderFn: func(arg *files.ListFolderArg) (*files.ListFolderResult, error) {
645 return nil, fmt.Errorf("list failed")
646 },
647 }
648 stubFilesClient(t, mock)
649
650 if err := ls(cmd, nil); err == nil {
651 t.Fatal("expected ls error")
652 }
653 if got := stdout.String(); got != "" {
654 t.Fatalf("stdout = %q, want empty output on error", got)
655 }
656}
657
658func TestLsCommandSupportsStructuredOutput(t *testing.T) {
659 if !commandSupportsStructuredOutput(lsCmd) {

Callers

nothing calls this directly

Calls 4

testLsCmdFunction · 0.85
setLsOutputJSONFunction · 0.85
stubFilesClientFunction · 0.85
lsFunction · 0.85

Tested by

no test coverage detected