Skip to content

Commit 2573273

Browse files
committed
Add mime-types-test
1 parent 8ea7569 commit 2573273

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/mime-types-test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import * as test from 'tape';
2+
import { lookup } from '../src/mime-types';
3+
4+
test('lookup .js', t => {
5+
t.plan(1);
6+
const mime = lookup('file.js');
7+
t.equal(mime, 'application/javascript');
8+
});
9+
10+
test('lookup .js.map', t => {
11+
t.plan(1);
12+
const mime = lookup('file.js.map');
13+
t.equal(mime, 'application/javascript');
14+
});
15+
16+
test('lookup .json', t => {
17+
t.plan(1);
18+
const mime = lookup('file.json');
19+
t.equal(mime, 'application/json');
20+
});
21+
22+
test('lookup .css', t => {
23+
t.plan(1);
24+
const mime = lookup('file.css');
25+
t.equal(mime, 'text/css');
26+
});
27+
28+
test('lookup .html', t => {
29+
t.plan(1);
30+
const mime = lookup('file.html');
31+
t.equal(mime, 'text/html');
32+
});
33+
34+
test('lookup .txt', t => {
35+
t.plan(1);
36+
const mime = lookup('/some/file.txt');
37+
t.equal(mime, 'text/plain');
38+
});

0 commit comments

Comments
 (0)