-
Notifications
You must be signed in to change notification settings - Fork 0
/
date.test.ts
37 lines (29 loc) · 919 Bytes
/
date.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
32
33
34
35
36
37
import { assertStrictEq, prepareTest } from "../test.mod.ts";
import { extend } from "./extend.ts";
import { difference, isAfter, isBefore, isDate } from "./date.ts";
extend({
date: [difference, isAfter, isBefore, isDate]
});
async function willExtendDatePrototype() {
const extensions = [
["Date.prototype.difference", "difference"],
["Date.prototype.isAfter", "isAfter"],
["Date.prototype.isBefore", "isBefore"]
];
const expectation = extensions.every(([_, methodName]) => {
return methodName in Date.prototype;
});
assertStrictEq(expectation, true);
}
async function willExtendDateConstructor() {
const extensions = [["Date.isDate", "isDate"]];
const expectation = extensions.every(([_, methodName]) => {
return methodName in Date;
});
assertStrictEq(expectation, true);
}
prepareTest(
[willExtendDateConstructor, willExtendDatePrototype],
"jsmodern",
"date"
);