@truedat/dd 8.10.2 → 8.10.3
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/package.json +3 -3
- package/src/components/Graphs.js +109 -0
- package/src/components/LineageDomainSelectorSkeleton.js +8 -0
- package/src/components/LineageDownloadButton.js +29 -6
- package/src/components/LineageEventsPanel.js +206 -0
- package/src/components/LineageForm.js +265 -144
- package/src/components/LineageGraph.js +0 -1
- package/src/components/LineageHeader.js +33 -0
- package/src/components/LineageResourceToggle.js +56 -0
- package/src/components/LineageRoutes.js +2 -31
- package/src/components/LineageSelectionPanel.js +165 -0
- package/src/components/__tests__/LineageForm.spec.js +343 -3
- package/src/components/__tests__/LineageRoutes.spec.js +62 -76
- package/src/components/__tests__/__snapshots__/LineageForm.spec.js.snap +291 -250
- package/src/components/__tests__/__snapshots__/LineageRoutes.spec.js.snap +19 -43
- package/src/components/index.js +12 -0
- package/src/components/lineageDomainCache.js +101 -0
- package/src/components/lineageEventHelpers.js +195 -0
- package/src/styles/lineageGraph.less +1213 -47
- package/src/components/Lineage.js +0 -20
- package/src/components/LineageSample.js +0 -20
- package/src/components/__tests__/Lineage.spec.js +0 -16
- package/src/components/__tests__/__snapshots__/Lineage.spec.js.snap +0 -163
|
@@ -1,40 +1,9 @@
|
|
|
1
1
|
import { render, waitForLoad } from "@truedat/test/render";
|
|
2
|
-
import
|
|
3
|
-
import { GRAPHS
|
|
2
|
+
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { GRAPHS } from "@truedat/core/routes";
|
|
4
|
+
import { LineageEventsPanel } from "../LineageEventsPanel";
|
|
4
5
|
import { LineageRoutes } from "../LineageRoutes";
|
|
5
6
|
|
|
6
|
-
// Mock the hooks module to use the mock implementation
|
|
7
|
-
jest.mock("@truedat/core/hooks/useAuthorized");
|
|
8
|
-
|
|
9
|
-
// Mock components used in LineageRoutes
|
|
10
|
-
jest.mock(
|
|
11
|
-
"../LineageEvents",
|
|
12
|
-
() =>
|
|
13
|
-
function LineageEvents() {
|
|
14
|
-
return <div>LineageEvents</div>;
|
|
15
|
-
},
|
|
16
|
-
);
|
|
17
|
-
jest.mock(
|
|
18
|
-
"../LineageGraph",
|
|
19
|
-
() =>
|
|
20
|
-
function LineageGraph() {
|
|
21
|
-
return <div>LineageGraph</div>;
|
|
22
|
-
},
|
|
23
|
-
);
|
|
24
|
-
jest.mock(
|
|
25
|
-
"../LineageSample",
|
|
26
|
-
() =>
|
|
27
|
-
function LineageSample() {
|
|
28
|
-
return <div>LineageSample</div>;
|
|
29
|
-
},
|
|
30
|
-
);
|
|
31
|
-
jest.mock(
|
|
32
|
-
"../LineageForm",
|
|
33
|
-
() =>
|
|
34
|
-
function LineageForm() {
|
|
35
|
-
return <div>LineageForm</div>;
|
|
36
|
-
},
|
|
37
|
-
);
|
|
38
7
|
jest.mock(
|
|
39
8
|
"../GraphLoader",
|
|
40
9
|
() =>
|
|
@@ -42,19 +11,6 @@ jest.mock(
|
|
|
42
11
|
return <div>GraphLoader</div>;
|
|
43
12
|
},
|
|
44
13
|
);
|
|
45
|
-
jest.mock(
|
|
46
|
-
"../GraphRedirector",
|
|
47
|
-
() =>
|
|
48
|
-
function GraphRedirector() {
|
|
49
|
-
return <div>GraphRedirector</div>;
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
jest.mock("@truedat/core/components", () => ({
|
|
53
|
-
Unauthorized: function Unauthorized() {
|
|
54
|
-
return <div>Unauthorized</div>;
|
|
55
|
-
},
|
|
56
|
-
...jest.requireActual("@truedat/core/components"),
|
|
57
|
-
}));
|
|
58
14
|
|
|
59
15
|
describe("<LineageRoutes />", () => {
|
|
60
16
|
it("renders correctly with default route", async () => {
|
|
@@ -63,7 +19,6 @@ describe("<LineageRoutes />", () => {
|
|
|
63
19
|
expect(rendered.container).toMatchSnapshot();
|
|
64
20
|
});
|
|
65
21
|
|
|
66
|
-
// Test each specific route in the component
|
|
67
22
|
it("renders correctly with GRAPHS route", async () => {
|
|
68
23
|
const rendered = render(<LineageRoutes />, {
|
|
69
24
|
routes: [GRAPHS],
|
|
@@ -71,37 +26,68 @@ describe("<LineageRoutes />", () => {
|
|
|
71
26
|
await waitForLoad(rendered);
|
|
72
27
|
expect(rendered.container).toMatchSnapshot();
|
|
73
28
|
});
|
|
29
|
+
});
|
|
74
30
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
31
|
+
describe("<LineageEventsPanel />", () => {
|
|
32
|
+
const lineageEvents = [
|
|
33
|
+
{
|
|
34
|
+
id: "old-lineage",
|
|
35
|
+
graph_id: 100,
|
|
36
|
+
graph_data: JSON.stringify(["node-b", "node-a"]),
|
|
37
|
+
type: "lineage",
|
|
38
|
+
status: "COMPLETED",
|
|
39
|
+
domain_name: "Finance",
|
|
40
|
+
inserted_at: "2021-11-26T10:09:27.168999Z",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "new-lineage",
|
|
44
|
+
graph_id: 101,
|
|
45
|
+
graph_data: JSON.stringify(["node-a", "node-b"]),
|
|
46
|
+
type: "lineage",
|
|
47
|
+
status: "COMPLETED",
|
|
48
|
+
domain_name: "Finance",
|
|
49
|
+
inserted_at: "2021-11-27T10:09:27.168999Z",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "impact-failed",
|
|
53
|
+
graph_id: 102,
|
|
54
|
+
graph_data: JSON.stringify(["node-a", "node-b"]),
|
|
55
|
+
type: "impact",
|
|
56
|
+
status: "FAILED",
|
|
57
|
+
message: "Graph generation failed",
|
|
58
|
+
inserted_at: "2021-11-28T10:09:27.168999Z",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "without-graph-id",
|
|
62
|
+
graph_data: JSON.stringify(["node-c"]),
|
|
63
|
+
status: "COMPLETED",
|
|
64
|
+
inserted_at: "2021-11-25T10:09:27.168999Z",
|
|
65
|
+
},
|
|
66
|
+
];
|
|
90
67
|
|
|
91
|
-
it("renders
|
|
92
|
-
const rendered = render(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
68
|
+
it("renders each event as its own card with type and status", async () => {
|
|
69
|
+
const rendered = render(
|
|
70
|
+
<LineageEventsPanel
|
|
71
|
+
lineageEvents={lineageEvents}
|
|
72
|
+
lineageEventsLoading={false}
|
|
73
|
+
/>,
|
|
74
|
+
);
|
|
75
|
+
const user = userEvent.setup({ delay: null });
|
|
98
76
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
expect(rendered.container.querySelectorAll("article")).toHaveLength(4);
|
|
78
|
+
expect(rendered.getByText("#101")).toBeInTheDocument();
|
|
79
|
+
expect(rendered.getByText("#100")).toBeInTheDocument();
|
|
80
|
+
expect(rendered.getByText("#102")).toBeInTheDocument();
|
|
81
|
+
expect(rendered.getByText("#without-graph-id")).toBeInTheDocument();
|
|
82
|
+
expect(rendered.getAllByText(/Finance/)).toHaveLength(2);
|
|
83
|
+
expect(rendered.getAllByText("OK")).toHaveLength(3);
|
|
84
|
+
expect(rendered.getByText("KO")).toBeInTheDocument();
|
|
85
|
+
expect(rendered.getAllByText("navigation.lineage.lineage")).toHaveLength(3);
|
|
86
|
+
expect(rendered.getByText("navigation.lineage.impact")).toBeInTheDocument();
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
88
|
+
await user.click(rendered.getByLabelText("lineage.events.panel.error"));
|
|
89
|
+
expect(
|
|
90
|
+
await rendered.findByText("Graph generation failed"),
|
|
91
|
+
).toBeInTheDocument();
|
|
106
92
|
});
|
|
107
93
|
});
|