Skip to content

Commit 05f9719

Browse files
authored
Merge pull request #7 from jsonjoy-com/move-sublibs
Add `json-size` and `json-clone`
2 parents 8a595a4 + 0dc6cac commit 05f9719

21 files changed

+5756
-0
lines changed

src/__tests__/binary-documents.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
export interface JsonDocument {
2+
name: string;
3+
json: unknown;
4+
only?: true;
5+
}
6+
7+
export const binaryDocuments: JsonDocument[] = [
8+
{
9+
name: 'buffer',
10+
json: new Uint8Array([1, 2, 3]),
11+
},
12+
{
13+
name: 'empty buffer',
14+
json: new Uint8Array([]),
15+
},
16+
{
17+
name: 'buffer in array',
18+
json: [new Uint8Array([1, 2, 3])],
19+
},
20+
{
21+
name: 'empty buffer in array',
22+
json: [new Uint8Array([])],
23+
},
24+
{
25+
name: 'buffer in object',
26+
json: {
27+
foo: new Uint8Array([]),
28+
},
29+
},
30+
{
31+
name: 'empty buffer in object',
32+
json: {
33+
foo: new Uint8Array([]),
34+
},
35+
},
36+
{
37+
name: 'multiple buffers in object',
38+
json: {
39+
foo: new Uint8Array([]),
40+
bar: new Uint8Array([1]),
41+
baz: new Uint8Array([221, 1]),
42+
},
43+
},
44+
{
45+
name: 'buffers in complex object',
46+
json: {
47+
a: 123,
48+
foo: new Uint8Array([]),
49+
arr: [
50+
true,
51+
null,
52+
new Uint8Array([5, 3, 4, 2, 2, 34, 2, 1]),
53+
{
54+
gg: new Uint8Array([1, 2, 55]),
55+
},
56+
],
57+
bar: new Uint8Array([1]),
58+
gg: 123,
59+
s: 'adsf',
60+
baz: new Uint8Array([221, 1]),
61+
},
62+
},
63+
];

0 commit comments

Comments
 (0)