deno.land / std@0.224.0 / media_types / type_by_extension_test.ts
12345678910111213141516171819202122232425// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/mod.ts";import { typeByExtension } from "./mod.ts";
Deno.test({ name: "typeByExtension()", fn() { const fixtures = [ ["js", "application/javascript"], [".js", "application/javascript"], ["Js", "application/javascript"], ["html", "text/html"], [".html", "text/html"], [".HTML", "text/html"], ["file.json", undefined], ["foo", undefined], [".foo", undefined], ] as const; for (const [fixture, expected] of fixtures) { assertEquals(typeByExtension(fixture), expected); } },});
Version Info