@etsoo/shared 1.2.52 → 1.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +6 -5
- package/__tests__/ArrayUtils.ts +126 -126
- package/__tests__/ColorUtils.ts +24 -24
- package/__tests__/ContentDisposition.ts +18 -18
- package/__tests__/DataTypes.ts +222 -204
- package/__tests__/DateUtils.ts +82 -82
- package/__tests__/DomUtils.ts +352 -352
- package/__tests__/EHistory.ts +62 -62
- package/__tests__/ExtendUtils.ts +40 -40
- package/__tests__/Keyboard.ts +14 -14
- package/__tests__/NumberUtils.ts +37 -39
- package/__tests__/StorageUtils.ts +27 -27
- package/__tests__/Utils.ts +361 -363
- package/__tests__/tsconfig.json +15 -15
- package/lib/cjs/ActionResult.d.ts +1 -1
- package/lib/cjs/ActionResult.js +3 -3
- package/lib/cjs/ArrayUtils.d.ts +1 -1
- package/lib/cjs/ArrayUtils.js +4 -4
- package/lib/cjs/ColorUtils.d.ts +1 -1
- package/lib/cjs/ColorUtils.js +2 -2
- package/lib/cjs/DataTypes.d.ts +6 -6
- package/lib/cjs/DataTypes.js +50 -51
- package/lib/cjs/DateUtils.d.ts +1 -1
- package/lib/cjs/DateUtils.js +27 -28
- package/lib/cjs/DomUtils.d.ts +3 -3
- package/lib/cjs/DomUtils.js +64 -73
- package/lib/cjs/ExtendUtils.d.ts +1 -1
- package/lib/cjs/ExtendUtils.js +6 -6
- package/lib/cjs/IActionResult.d.ts +1 -1
- package/lib/cjs/NumberUtils.d.ts +1 -1
- package/lib/cjs/NumberUtils.js +9 -9
- package/lib/cjs/StorageUtils.js +2 -2
- package/lib/cjs/Utils.d.ts +4 -4
- package/lib/cjs/Utils.js +58 -62
- package/lib/cjs/index.d.ts +22 -22
- package/lib/cjs/storage/WindowStorage.d.ts +1 -1
- package/lib/cjs/types/ContentDisposition.d.ts +2 -2
- package/lib/cjs/types/ContentDisposition.js +11 -13
- package/lib/cjs/types/EColor.js +5 -7
- package/lib/cjs/types/EHistory.d.ts +3 -3
- package/lib/cjs/types/EHistory.js +4 -4
- package/lib/cjs/types/ErrorData.d.ts +1 -1
- package/lib/cjs/types/EventClass.js +1 -1
- package/lib/mjs/ActionResult.d.ts +1 -1
- package/lib/mjs/ActionResult.js +3 -3
- package/lib/mjs/ArrayUtils.d.ts +1 -1
- package/lib/mjs/ArrayUtils.js +5 -5
- package/lib/mjs/ColorUtils.d.ts +1 -1
- package/lib/mjs/ColorUtils.js +3 -3
- package/lib/mjs/DataTypes.d.ts +6 -6
- package/lib/mjs/DataTypes.js +50 -51
- package/lib/mjs/DateUtils.d.ts +1 -1
- package/lib/mjs/DateUtils.js +27 -28
- package/lib/mjs/DomUtils.d.ts +3 -3
- package/lib/mjs/DomUtils.js +67 -76
- package/lib/mjs/ExtendUtils.d.ts +1 -1
- package/lib/mjs/ExtendUtils.js +6 -6
- package/lib/mjs/IActionResult.d.ts +1 -1
- package/lib/mjs/NumberUtils.d.ts +1 -1
- package/lib/mjs/NumberUtils.js +9 -9
- package/lib/mjs/StorageUtils.js +4 -4
- package/lib/mjs/Utils.d.ts +4 -4
- package/lib/mjs/Utils.js +61 -65
- package/lib/mjs/index.d.ts +22 -22
- package/lib/mjs/index.js +22 -22
- package/lib/mjs/storage/WindowStorage.d.ts +1 -1
- package/lib/mjs/storage/WindowStorage.js +2 -2
- package/lib/mjs/types/ContentDisposition.d.ts +2 -2
- package/lib/mjs/types/ContentDisposition.js +12 -14
- package/lib/mjs/types/EColor.js +5 -7
- package/lib/mjs/types/EHistory.d.ts +3 -3
- package/lib/mjs/types/EHistory.js +5 -5
- package/lib/mjs/types/ErrorData.d.ts +1 -1
- package/lib/mjs/types/EventClass.js +1 -1
- package/package.json +61 -63
- package/src/ActionResult.ts +23 -23
- package/src/ArrayUtils.ts +164 -172
- package/src/ColorUtils.ts +80 -82
- package/src/DataTypes.ts +745 -754
- package/src/DateUtils.ts +266 -268
- package/src/DomUtils.ts +806 -831
- package/src/ExtendUtils.ts +191 -191
- package/src/IActionResult.ts +42 -42
- package/src/Keyboard.ts +258 -258
- package/src/NumberUtils.ts +135 -135
- package/src/StorageUtils.ts +117 -117
- package/src/Utils.ts +908 -930
- package/src/index.ts +22 -22
- package/src/node/Storage.ts +53 -53
- package/src/storage/IStorage.ts +62 -62
- package/src/storage/WindowStorage.ts +140 -140
- package/src/types/ContentDisposition.ts +59 -63
- package/src/types/DataError.ts +15 -15
- package/src/types/DelayedExecutorType.ts +15 -15
- package/src/types/EColor.ts +241 -248
- package/src/types/EHistory.ts +151 -151
- package/src/types/ErrorData.ts +11 -11
- package/src/types/EventClass.ts +220 -220
- package/src/types/FormData.ts +25 -25
- package/src/types/ParsedPath.ts +5 -5
- package/tsconfig.cjs.json +16 -16
- package/tsconfig.json +16 -16
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -29
- package/.prettierignore +0 -5
- package/.prettierrc +0 -6
package/__tests__/EHistory.ts
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { EHistory, EHistoryNavigateEvent } from
|
|
1
|
+
import { EHistory, EHistoryNavigateEvent } from "../src/types/EHistory";
|
|
2
2
|
|
|
3
3
|
// Extended for tests
|
|
4
4
|
class LHistory extends EHistory<number> {}
|
|
5
5
|
|
|
6
|
-
test(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
test("Tests for history", () => {
|
|
7
|
+
const history = new LHistory();
|
|
8
|
+
expect(history.index).toBe(-1);
|
|
9
|
+
history.pushState(1);
|
|
10
|
+
expect(history.getStatus()).toStrictEqual([false, false]);
|
|
11
|
+
history.pushState(2);
|
|
12
|
+
history.pushState(3);
|
|
13
|
+
expect(history.getStatus()).toStrictEqual([true, false]);
|
|
14
|
+
expect(history.states).toStrictEqual([1, 2, 3]);
|
|
15
|
+
expect(history.index).toBe(2);
|
|
16
|
+
history.back();
|
|
17
|
+
expect(history.getStatus()).toStrictEqual([true, true]);
|
|
18
|
+
history.pushState(4);
|
|
19
|
+
expect(history.index).toBe(2);
|
|
20
|
+
expect(history.states).toStrictEqual([1, 2, 4]);
|
|
21
|
+
history.go(-2);
|
|
22
|
+
expect(history.state).toBe(1);
|
|
23
|
+
history.forward();
|
|
24
|
+
expect(history.index).toBe(1);
|
|
25
|
+
history.replaceState(0);
|
|
26
|
+
expect(history.state).toBe(0);
|
|
27
|
+
history.clear();
|
|
28
|
+
expect(history.length).toBe(0);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
test(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
test("Tests for events", () => {
|
|
32
|
+
const navigatorFn = jest.fn();
|
|
33
|
+
const navigatorStopFn = jest.fn((event: EHistoryNavigateEvent) => {
|
|
34
|
+
event.stopImmediatePropagation();
|
|
35
|
+
});
|
|
36
|
+
const clearFn = jest.fn();
|
|
37
|
+
const pushFn = jest.fn();
|
|
38
|
+
const replaceFn = jest.fn();
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const history = new LHistory(3);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
history.on({
|
|
43
|
+
clear: clearFn,
|
|
44
|
+
push: pushFn,
|
|
45
|
+
replace: replaceFn,
|
|
46
|
+
navigate: navigatorFn
|
|
47
|
+
});
|
|
48
|
+
history.on("navigate", navigatorFn);
|
|
49
|
+
history.on("navigate", navigatorFn, { capture: true, once: true });
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
history.clear();
|
|
52
|
+
expect(clearFn).toHaveBeenCalled();
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
history.pushState(1);
|
|
55
|
+
expect(pushFn).toHaveBeenCalled();
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
history.replaceState(11);
|
|
58
|
+
expect(replaceFn).toHaveBeenCalled();
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
history.pushState(2);
|
|
61
|
+
history.back();
|
|
62
|
+
expect(navigatorFn).toHaveBeenCalledTimes(3);
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
history.forward();
|
|
65
|
+
// Once handler was removed
|
|
66
|
+
expect(navigatorFn).toHaveBeenCalledTimes(5);
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
history.on("navigate", navigatorStopFn, { capture: true });
|
|
69
|
+
history.go(-1);
|
|
70
|
+
expect(navigatorStopFn).toHaveBeenCalled();
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
// Previous handler stopped propagation
|
|
73
|
+
expect(navigatorFn).toHaveBeenCalledTimes(5);
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
history.pushState(3);
|
|
76
|
+
history.pushState(4);
|
|
77
|
+
history.pushState(5);
|
|
78
|
+
expect(history.length).toBe(3);
|
|
79
79
|
});
|
package/__tests__/ExtendUtils.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { ExtendUtils } from
|
|
1
|
+
import { ExtendUtils } from "../src/ExtendUtils";
|
|
2
2
|
|
|
3
|
-
test(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
test("Tests for applyMixins", () => {
|
|
4
|
+
class a {
|
|
5
|
+
m() {
|
|
6
|
+
return 1;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
}
|
|
9
|
+
class b {
|
|
10
|
+
m(id: number) {
|
|
11
|
+
return id;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
}
|
|
14
|
+
class c {
|
|
15
|
+
m2() {
|
|
16
|
+
return "hello";
|
|
18
17
|
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
interface a extends b, c {}
|
|
21
|
+
ExtendUtils.applyMixins(a, [b, c]);
|
|
22
|
+
const item = new a();
|
|
23
|
+
expect(item.m2()).toBe("hello");
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
test(
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
test("Tests for delayedExecutor", () => {
|
|
27
|
+
// Arrange
|
|
28
|
+
const f = jest.fn();
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const e = ExtendUtils.delayedExecutor(f, 50);
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
e.call(1, false, "a");
|
|
33
|
+
expect(e.isRunning()).toBeTruthy();
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
e.call(2, true, "b");
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
expect(f).toHaveBeenCalledTimes(0);
|
|
38
|
+
e.clear();
|
|
39
|
+
expect(e.isRunning()).toBeFalsy();
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
test(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
test("Tests for promiseHandler", async () => {
|
|
43
|
+
// Arrange
|
|
44
|
+
const p = (id: number) => {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
if (id > 0) resolve(id);
|
|
47
|
+
else reject(new Error(`Id ${id} Error`));
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const handler1 = await ExtendUtils.promiseHandler(p(12));
|
|
52
|
+
expect(handler1[0]).toBe(12);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const handler2 = await ExtendUtils.promiseHandler(p(-1));
|
|
55
|
+
expect(handler2[1]).toHaveProperty("message", "Id -1 Error");
|
|
56
56
|
});
|
package/__tests__/Keyboard.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Keyboard } from
|
|
1
|
+
import { Keyboard } from "../src/Keyboard";
|
|
2
2
|
|
|
3
|
-
test(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
test("Tests for KeyboardEvent.key", () => {
|
|
4
|
+
const event = new KeyboardEvent("keydown", { key: " " });
|
|
5
|
+
const callback = (e: KeyboardEvent) => {
|
|
6
|
+
expect(e.key).toBe(Keyboard.Keys.Space);
|
|
7
|
+
};
|
|
8
|
+
window.addEventListener("keydown", callback);
|
|
9
|
+
window.dispatchEvent(event);
|
|
10
|
+
window.removeEventListener("keydown", callback);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
test(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
test("Tests for isTypingContent", () => {
|
|
14
|
+
expect(Keyboard.isTypingContent(Keyboard.Keys.A)).toBeTruthy();
|
|
15
|
+
expect(Keyboard.isTypingContent(Keyboard.Keys.Ampersand)).toBeTruthy();
|
|
16
|
+
expect(Keyboard.isTypingContent(Keyboard.Keys.Shift)).toBeFalsy();
|
|
17
|
+
expect(Keyboard.isTypingContent(Keyboard.Keys.PrintScreen)).toBeFalsy();
|
|
18
18
|
});
|
package/__tests__/NumberUtils.ts
CHANGED
|
@@ -1,54 +1,52 @@
|
|
|
1
|
-
import { NumberUtils } from
|
|
1
|
+
import { NumberUtils } from "../src/NumberUtils";
|
|
2
2
|
|
|
3
|
-
test(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
test("Tests for format", () => {
|
|
4
|
+
expect(NumberUtils.format(12.4, "zh-CN", { style: "percent" })).toBe(
|
|
5
|
+
"1,240%"
|
|
6
|
+
);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
test(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
test("Tests for formatMoney", () => {
|
|
10
|
+
expect(NumberUtils.formatMoney(1282.4, "CNY", "zh-CN")).toBe("¥1,282.40");
|
|
11
|
+
expect(NumberUtils.formatMoney(1282, "CNY", "zh-CN", true)).toBe("¥1,282");
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
test(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
test("Tests for getCurrencySymbol", () => {
|
|
15
|
+
expect(NumberUtils.getCurrencySymbol("CNY")).toBe("¥");
|
|
16
|
+
expect(NumberUtils.getCurrencySymbol("USD")).toBe("$");
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'人民币'
|
|
22
|
-
);
|
|
18
|
+
// When locale = 'en-US' will be failed with '$'
|
|
19
|
+
expect(NumberUtils.getCurrencySymbol("USD", "symbol", "zh-CN")).toBe("US$");
|
|
20
|
+
expect(NumberUtils.getCurrencySymbol("CNY", "name", "zh-CN")).toBe("人民币");
|
|
23
21
|
});
|
|
24
22
|
|
|
25
|
-
test(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
test("Tests for parse", () => {
|
|
24
|
+
expect(NumberUtils.parse("123")).toBe(123);
|
|
25
|
+
expect(NumberUtils.parse(Object(123))).toBe(123);
|
|
26
|
+
expect(NumberUtils.parse("a")).toBeUndefined();
|
|
27
|
+
expect(NumberUtils.parse("a", 0)).toBe(0);
|
|
28
|
+
expect(NumberUtils.parse("")).toBeUndefined();
|
|
29
|
+
expect(NumberUtils.parse("", -1)).toBe(-1);
|
|
32
30
|
});
|
|
33
31
|
|
|
34
|
-
test(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
test("Tests for parseWithUnit", () => {
|
|
33
|
+
expect(NumberUtils.parseWithUnit("8px")).toStrictEqual([8, "px"]);
|
|
34
|
+
expect(NumberUtils.parseWithUnit("16")).toStrictEqual([16, ""]);
|
|
35
|
+
expect(NumberUtils.parseWithUnit("a16")).toBeUndefined();
|
|
38
36
|
});
|
|
39
37
|
|
|
40
|
-
test(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
test("Tests for toExact", () => {
|
|
39
|
+
// 0.7000000000000001
|
|
40
|
+
const result = 0.8 - 0.1;
|
|
41
|
+
expect(result).not.toBe(0.7);
|
|
42
|
+
expect(result.toExact()).toBe(0.7);
|
|
45
43
|
});
|
|
46
44
|
|
|
47
|
-
test(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
test("Tests for toFileSize", () => {
|
|
46
|
+
expect(NumberUtils.formatFileSize(1551859712)).toBe("1.45 GB");
|
|
47
|
+
expect(NumberUtils.formatFileSize(1551859712, 1)).toBe("1.4 GB");
|
|
48
|
+
expect(NumberUtils.formatFileSize(5000)).toBe("4.88 KB");
|
|
49
|
+
expect(NumberUtils.formatFileSize(999949)).toBe("976.51 KB");
|
|
50
|
+
expect(NumberUtils.formatFileSize(1125000)).toBe("1.07 MB");
|
|
51
|
+
expect(NumberUtils.formatFileSize(1125000, 1)).toBe("1.1 MB");
|
|
54
52
|
});
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { StorageUtils } from
|
|
1
|
+
import { StorageUtils } from "../src/StorageUtils";
|
|
2
2
|
|
|
3
|
-
test(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
test("Tests for all", () => {
|
|
4
|
+
// Arrange
|
|
5
|
+
StorageUtils.setSessionData("string", "test");
|
|
6
|
+
StorageUtils.setSessionData("boolean", true);
|
|
7
|
+
StorageUtils.setSessionData("number", 3.14);
|
|
8
|
+
StorageUtils.setSessionData("test", { id: 123, name: "test" });
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const array = StorageUtils.getSessionData<string[]>("array", []);
|
|
11
|
+
array.push("new");
|
|
12
|
+
StorageUtils.setSessionData("array", array);
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
expect(StorageUtils.getSessionData<string>("string")).toBe("test");
|
|
15
|
+
expect(StorageUtils.getSessionData("string1", "")).toBe("");
|
|
16
|
+
expect(StorageUtils.getSessionData("boolean", false)).toBe(true);
|
|
17
|
+
expect(StorageUtils.getSessionData("number", 0)).toBe(3.14);
|
|
18
|
+
expect(StorageUtils.getSessionData("number1", 0)).toBe(0);
|
|
19
|
+
expect(StorageUtils.getSessionData("test", {})).toHaveProperty("id", 123);
|
|
20
|
+
expect(StorageUtils.getSessionData<string[]>("array")).toEqual(array);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
test(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
test("Tests for getLocalObject", () => {
|
|
24
|
+
StorageUtils.setLocalData("test", { id: 123, name: "test" });
|
|
25
|
+
const data = StorageUtils.getLocalObject<{ id: number }>("test");
|
|
26
|
+
expect(data?.id).toBe(123);
|
|
27
|
+
expect(data).toHaveProperty("name", "test");
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
test(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
test("Tests for getSessionObject", () => {
|
|
31
|
+
StorageUtils.setSessionData("test", { id: 123, name: "test" });
|
|
32
|
+
const data = StorageUtils.getSessionObject<{ id: number }>("test");
|
|
33
|
+
expect(data?.id).toBe(123);
|
|
34
|
+
expect(data).toHaveProperty("name", "test");
|
|
35
35
|
});
|