-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
util_test.ts
22 lines (21 loc) 路 854 Bytes
/
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
// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license.
import { test, runIfMain } from "./vendor/https/deno.land/std/testing/mod.ts";
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts";
import { dateToDateHeader, pathResolver } from "./util.ts";
import { it } from "./test_util.ts";
test("dateToDateHeader", () => {
const res = dateToDateHeader(new Date("2019-09-15T08:20:15Z"));
assertEquals(res, "Sun, 15 Sep 2019 08:20:15 GMT");
});
it("pathResolver", t => {
[
["file://src/deno/index.js", "./other.js", "file://src/deno/other.js"],
["file://src/deno/", "./other.js", "file://src/deno/other.js"]
].forEach(([base, path, exp]) => {
t.run(`${base} + ${path}`, () => {
const u = pathResolver(base)(path);
assertEquals(u.toString(), exp);
});
});
});
runIfMain(import.meta);