Skip to content

Commit 1d18361

Browse files
committed
fix: prevent false positive warnings on empty editor trace
1 parent 9692a74 commit 1d18361

File tree

5 files changed

+509
-26
lines changed

5 files changed

+509
-26
lines changed

packages/pluggableWidgets/custom-chart-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"publish-marketplace": "rui-publish-marketplace",
4040
"release": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pluggable-widgets-tools release:web",
4141
"start": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pluggable-widgets-tools start:server",
42-
"test": "echo 'FIXME: Finish custom-chart-web unit test migration'",
42+
"test": "jest",
4343
"update-changelog": "rui-update-changelog-widget",
4444
"verify": "rui-verify-package-format"
4545
},
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`mergeChartProps utility function Data merging behavior should only process traces that exist in chart props 1`] = `[]`;
4+
5+
exports[`mergeChartProps utility function Data merging behavior should preserve original trace data when editor state has missing or falsy entries 1`] = `[]`;
6+
7+
exports[`mergeChartProps utility function Edge cases should handle empty chart props data 1`] = `[]`;
8+
9+
exports[`mergeChartProps utility function Edge cases should handle falsy values in editor state data without warnings 1`] = `[]`;
10+
11+
exports[`mergeChartProps utility function Edge cases should handle null JSON parsing 1`] = `[]`;
12+
13+
exports[`mergeChartProps utility function Edge cases should handle various malformed JSON types 1`] = `
14+
[
15+
[
16+
"Editor props for trace(1) is not a valid JSON:{invalid json}",
17+
],
18+
[
19+
"Please make sure the props is a valid JSON string.",
20+
],
21+
[
22+
"Editor props for trace(3) is not a valid JSON:undefined",
23+
],
24+
[
25+
"Please make sure the props is a valid JSON string.",
26+
],
27+
]
28+
`;
29+
30+
exports[`mergeChartProps utility function JSON parsing failures generate console warnings should handle mixed valid and invalid JSON 1`] = `
31+
[
32+
[
33+
"Editor props for trace(1) is not a valid JSON:invalid json",
34+
],
35+
[
36+
"Please make sure the props is a valid JSON string.",
37+
],
38+
]
39+
`;
40+
41+
exports[`mergeChartProps utility function JSON parsing failures generate console warnings should not warn for valid JSON 1`] = `[]`;
42+
43+
exports[`mergeChartProps utility function JSON parsing failures generate console warnings should not warn when editor state has undefined entries 1`] = `[]`;
44+
45+
exports[`mergeChartProps utility function JSON parsing failures generate console warnings should warn for invalid JSON in editor state data 1`] = `
46+
[
47+
[
48+
"Editor props for trace(0) is not a valid JSON:invalid json",
49+
],
50+
[
51+
"Please make sure the props is a valid JSON string.",
52+
],
53+
]
54+
`;
55+
56+
exports[`mergeChartProps utility function JSON parsing failures generate console warnings should warn for multiple invalid JSON entries 1`] = `
57+
[
58+
[
59+
"Editor props for trace(0) is not a valid JSON:invalid json",
60+
],
61+
[
62+
"Please make sure the props is a valid JSON string.",
63+
],
64+
[
65+
"Editor props for trace(1) is not a valid JSON:{broken: json}",
66+
],
67+
[
68+
"Please make sure the props is a valid JSON string.",
69+
],
70+
]
71+
`;

0 commit comments

Comments
 (0)