MCPcopy Index your code
hub / github.com/coder/coder / TestIsCompatibleUploadMediaType

Function TestIsCompatibleUploadMediaType

coderd/x/chatfiles/mime_test.go:258–323  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func TestIsCompatibleUploadMediaType(t *testing.T) {
259 t.Parallel()
260
261 tests := []struct {
262 name string
263 declared string
264 stored string
265 want bool
266 }{
267 {
268 name: "ExactMatch",
269 declared: "text/plain",
270 stored: "text/plain",
271 want: true,
272 },
273 {
274 name: "OctetStreamMatchesPNG",
275 declared: "application/octet-stream",
276 stored: "image/png",
277 want: true,
278 },
279 {
280 name: "OctetStreamMatchesJSON",
281 declared: "application/octet-stream",
282 stored: "application/json",
283 want: true,
284 },
285 {
286 name: "TextPlainRefinesToMarkdown",
287 declared: "text/plain",
288 stored: "text/markdown",
289 want: true,
290 },
291 {
292 name: "TextPlainRefinesToCSV",
293 declared: "text/plain",
294 stored: "text/csv",
295 want: true,
296 },
297 {
298 name: "TextPlainRefinesToJSON",
299 declared: "text/plain",
300 stored: "application/json",
301 want: true,
302 },
303 {
304 name: "TextPlainDoesNotRefineToPNG",
305 declared: "text/plain",
306 stored: "image/png",
307 want: false,
308 },
309 {
310 name: "JSONDoesNotRefineToPlainText",
311 declared: "application/json",
312 stored: "text/plain",
313 want: false,
314 },
315 }

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected