(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestGetContentType(t *testing.T) { |
| 103 | cases := []struct { |
| 104 | Give Spec |
| 105 | ContentType string |
| 106 | }{ |
| 107 | {Give: Spec{Path: "test/path", FileSpec: filetypes.FileSpec{Format: "json"}}, ContentType: "application/json"}, |
| 108 | {Give: Spec{Path: "test/path", FileSpec: filetypes.FileSpec{Format: "csv"}}, ContentType: "text/csv"}, |
| 109 | {Give: Spec{Path: "test/path", FileSpec: filetypes.FileSpec{Format: "parquet"}}, ContentType: "application/vnd.apache.parquet"}, |
| 110 | {Give: Spec{Path: "test/path", FileSpec: filetypes.FileSpec{Format: "parquet", Compression: "gzip"}}, ContentType: "application/gzip"}, |
| 111 | {Give: Spec{Path: "test/path", ContentType: "application/custom", FileSpec: filetypes.FileSpec{Format: "parquet", Compression: "gzip"}}, ContentType: "application/custom"}, |
| 112 | } |
| 113 | for i, tc := range cases { |
| 114 | tc := tc |
| 115 | t.Run(fmt.Sprintf("Case %d", i+1), func(t *testing.T) { |
| 116 | require.Equal(t, tc.ContentType, tc.Give.GetContentType()) |
| 117 | }) |
| 118 | } |
| 119 | } |
nothing calls this directly
no test coverage detected