deno.land / x / lume@v2.1.4 / tests / core / renderer.test.ts

renderer.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { assert, assertStrictEquals as equals } from "../../deps/assert.ts";import { build, getSite } from "../utils.ts";import { parseDate } from "../../core/utils/date.ts";
Deno.test("Prepare page (Renderer)", async (t) => { const site = getSite({ src: "simple", });
await build(site);
await t.step("Calculate the date", () => { const date = parseDate("2020-01-01"); assert(date instanceof Date); equals(date.getFullYear(), 2020); equals(date.getMonth(), 0); equals(date.getDate(), 1); equals(date.getHours(), 0); equals(date.getMinutes(), 0); equals(date.getSeconds(), 0); });
await t.step("Calculate the datetime", () => { const date = parseDate("2021-01-01 03:10:10"); assert(date instanceof Date); equals(date.getFullYear(), 2021); equals(date.getMonth(), 0); equals(date.getDate(), 1); equals(date.getHours(), 3); equals(date.getMinutes(), 10); equals(date.getSeconds(), 10); });
await t.step("Calculate ISO datestimes", () => { const date = parseDate("2021-01-01T03:10:10Z"); assert(date instanceof Date); equals(date.getFullYear(), 2021); equals(date.getMonth(), 0); equals(date.getDate(), 1); equals(date.getHours(), 3); equals(date.getMinutes(), 10); equals(date.getSeconds(), 10); });
await t.step("Calculate ISO datestimes 2", () => { const date = parseDate("2021-01-01T03:10:10-0700"); assert(date instanceof Date); equals(date.getFullYear(), 2021); equals(date.getMonth(), 0); equals(date.getDate(), 1); equals(date.getHours(), 10); equals(date.getMinutes(), 10); equals(date.getSeconds(), 10); });
await t.step("Calculate ISO datestimes 3", () => { const date = parseDate("20210101"); assert(date instanceof Date); equals(date.getFullYear(), 2021); equals(date.getMonth(), 0); equals(date.getDate(), 1); equals(date.getHours(), 0); equals(date.getMinutes(), 0); equals(date.getSeconds(), 0); });
await t.step("Calculate ISO datestimes 4", () => { const date = parseDate("20210101T031010Z"); assert(date instanceof Date); equals(date.getFullYear(), 2021); equals(date.getMonth(), 0); equals(date.getDate(), 1); equals(date.getHours(), 3); equals(date.getMinutes(), 10); equals(date.getSeconds(), 10); });});
lume

Version Info

Tagged at
7 months ago