-
Notifications
You must be signed in to change notification settings - Fork 47
/
util_test.ts
31 lines (30 loc) · 1.19 KB
/
util_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts";
import { contentType } from "./util.ts";
import { MIME } from "./constants.ts";
const { test } = Deno;
test("util content type", function (): void {
assertEquals(contentType("/path/to/file"), undefined);
assertEquals(contentType("/path/to/file.md"), MIME.TextMarkdownCharsetUTF8);
assertEquals(contentType("/path/to/file.html"), MIME.TextHTMLCharsetUTF8);
assertEquals(contentType("/path/to/file.htm"), MIME.TextHTMLCharsetUTF8);
assertEquals(contentType("/path/to/file.json"), MIME.ApplicationJSON);
assertEquals(contentType("/path/to/file.map"), MIME.ApplicationJSON);
assertEquals(contentType("/path/to/file.txt"), MIME.TextPlainCharsetUTF8);
assertEquals(
contentType("/path/to/file.ts"),
MIME.ApplicationJavaScriptCharsetUTF8,
);
assertEquals(
contentType("/path/to/file.tsx"),
MIME.ApplicationJavaScriptCharsetUTF8,
);
assertEquals(
contentType("/path/to/file.js"),
MIME.ApplicationJavaScriptCharsetUTF8,
);
assertEquals(
contentType("/path/to/file.jsx"),
MIME.ApplicationJavaScriptCharsetUTF8,
);
assertEquals(contentType("/path/to/file.gz"), MIME.ApplicationGZip);
});