-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
62 lines (42 loc) · 1.44 KB
/
test.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>lz-utils test</title>
</head>
<body>
<script src="../.temp/test.data.js"></script>
<script src="../dist/browser.js"></script>
<script>
</script>
<script type="module">
const test = async () => {
const LZ = window['lz-utils'];
console.log(LZ);
const {
decompress, inflate, inflateSync
} = LZ;
const testData = window.testData;
console.log(testData.raw);
const decompressStr = decompress(testData.decompressStr);
// console.log('decompressStr', decompressStr);
const decompressData = JSON.parse(decompressStr);
console.log(decompressData);
decompressData.list.forEach((item, i) => {
console.assert(item === testData.raw.list[i]);
});
const inflateStrSync = inflateSync(testData.inflateStr);
const inflateStr = await inflate(testData.inflateStr);
console.assert(inflateStrSync === inflateStr);
// console.log(inflateStr);
const inflateData = JSON.parse(inflateStr);
console.log(inflateData);
inflateData.list.forEach((item, i) => {
console.assert(item === testData.raw.list[i]);
});
};
test();
</script>
</body>
</html>