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

Function TestNewJSONOperationOutputNormalizesWarnings

cmd/output_test.go:720–750  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

718}
719
720func TestNewJSONOperationOutputNormalizesWarnings(t *testing.T) {
721 got := newJSONOperationOutput(
722 struct {
723 Path string `json:"path"`
724 }{Path: "/file.txt"},
725 []jsonOperationResult{
726 {
727 Status: "downloaded",
728 Kind: "file",
729 Input: struct {
730 Path string `json:"path"`
731 }{Path: "/file.txt"},
732 Result: struct {
733 Type string `json:"type"`
734 }{Type: "file"},
735 },
736 },
737 nil,
738 )
739
740 encoded, err := json.Marshal(got)
741 if err != nil {
742 t.Fatalf("marshal operation output: %v", err)
743 }
744 if !strings.Contains(string(encoded), `"warnings":[]`) {
745 t.Fatalf("encoded output = %s, want warnings array", encoded)
746 }
747 if got.Warnings == nil {
748 t.Fatal("warnings is nil, want empty slice")
749 }
750}
751
752func TestNewJSONOperationOutputNormalizesResults(t *testing.T) {
753 got := newJSONOperationOutput(nil, nil, nil)

Callers

nothing calls this directly

Calls 1

newJSONOperationOutputFunction · 0.85

Tested by

no test coverage detected