-
Notifications
You must be signed in to change notification settings - Fork 569
/
Copy pathjsonColumnView.test.ts
78 lines (76 loc) · 1.72 KB
/
jsonColumnView.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 { generateColumnViewNode } from "../app/utilities/jsonColumnView";
describe("generateColumnViewNode", () => {
test("it creates the correct tree structure for the passed in JSON", () => {
const json = {
string: "foo bar",
data: { foo: "bar" },
array: [
{
string: "foo bar",
},
],
};
expect(generateColumnViewNode(json)).toMatchInlineSnapshot(`
Object {
"children": Array [
Object {
"children": Array [],
"icon": [Function],
"id": "$.string",
"name": "string",
"subtitle": "foo bar",
"title": "string",
},
Object {
"children": Array [
Object {
"children": Array [],
"icon": [Function],
"id": "$.data.foo",
"name": "foo",
"subtitle": "bar",
"title": "foo",
},
],
"icon": [Function],
"id": "$.data",
"name": "data",
"subtitle": "1 field",
"title": "data",
},
Object {
"children": Array [
Object {
"children": Array [
Object {
"children": Array [],
"icon": [Function],
"id": "$.array.0.string",
"name": "string",
"subtitle": "foo bar",
"title": "string",
},
],
"icon": [Function],
"id": "$.array.0",
"longTitle": "Index 0",
"name": "0",
"subtitle": "1 field",
"title": "0",
},
],
"icon": [Function],
"id": "$.array",
"name": "array",
"subtitle": "1 item",
"title": "array",
},
],
"icon": [Function],
"id": "$",
"name": "root",
"title": "root",
}
`);
});
});