forked from bssm-portfolio/app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdate.spec.ts
57 lines (44 loc) · 1.51 KB
/
date.spec.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
import { getKoreanDate, getTimeAgo, isISODateString } from "./date";
test("koreanDate test - before 2000", () => {
expect(getKoreanDate(new Date("December 17, 1995"))).toBe("1995년 12월 17일");
});
test("koreanDate test - after 2000", () => {
expect(getKoreanDate(new Date("December 17, 2005"))).toBe("2005년 12월 17일");
});
test("timeAgo test - now", () => {
expect(getTimeAgo(new Date())).toBe("방금");
});
test("isISODateString test", () => {
expect(isISODateString(new Date().toISOString())).toBe(true);
});
test("isISODateString test", () => {
expect(isISODateString(new Date().toString())).toBe(false);
});
test("isISODateString test", () => {
expect(isISODateString(new Date().toLocaleDateString())).toBe(false);
});
test("isISODateString test", () => {
expect(isISODateString("ㅇㅇㅇㅇ")).toBe(false);
});
test("isISODateString test", () => {
expect(isISODateString("2012-01-01T17:52:10Z")).toBe(true);
});
test("isISODateString test", () => {
expect(isISODateString("2012-01-01T17:52:10")).toBe(true);
});
test("isISODateString test", () => {
expect(isISODateString("2012-01-01T17:52")).toBe(true);
});
test("isISODateString test", () => {
expect(isISODateString("2012-01-01T17:52:10.37488")).toBe(true);
});
test("isISODateString test", () => {
expect(
isISODateString(
"2012-01-01T17:52:10.3749999999999999999999999999999999999988Z",
),
).toBe(true);
});
test("isISODateString test", () => {
expect(isISODateString("2012-01-01T17:52:10.23-12:00")).toBe(true);
});