(t *testing.T)
| 718 | } |
| 719 | |
| 720 | func 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 | |
| 752 | func TestNewJSONOperationOutputNormalizesResults(t *testing.T) { |
| 753 | got := newJSONOperationOutput(nil, nil, nil) |
nothing calls this directly
no test coverage detected