@truedat/ie 7.5.7 → 7.5.10

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.
Files changed (106) hide show
  1. package/package.json +42 -67
  2. package/src/ingests/components/EventRow.js +1 -2
  3. package/src/ingests/components/Events.js +3 -4
  4. package/src/ingests/components/FieldGroupTable.js +1 -2
  5. package/src/ingests/components/Ingest.js +1 -2
  6. package/src/ingests/components/IngestActions.js +1 -2
  7. package/src/ingests/components/IngestArchive.js +2 -3
  8. package/src/ingests/components/IngestArchiveLoader.js +16 -38
  9. package/src/ingests/components/IngestArchiveRow.js +5 -6
  10. package/src/ingests/components/IngestCompleteness.js +0 -1
  11. package/src/ingests/components/IngestCrumbs.js +2 -4
  12. package/src/ingests/components/IngestDetails.js +3 -3
  13. package/src/ingests/components/IngestDuplicate.js +5 -8
  14. package/src/ingests/components/IngestEdit.js +5 -8
  15. package/src/ingests/components/IngestExecutions.js +7 -7
  16. package/src/ingests/components/IngestExecutionsLoader.js +2 -2
  17. package/src/ingests/components/IngestFilters.js +5 -6
  18. package/src/ingests/components/IngestForm.js +4 -5
  19. package/src/ingests/components/IngestHeader.js +0 -1
  20. package/src/ingests/components/IngestLoader.js +16 -58
  21. package/src/ingests/components/IngestRoutes.js +272 -231
  22. package/src/ingests/components/IngestRow.js +4 -5
  23. package/src/ingests/components/IngestSelectedFilters.js +10 -10
  24. package/src/ingests/components/IngestSummary.js +0 -2
  25. package/src/ingests/components/IngestTabs.js +13 -13
  26. package/src/ingests/components/Ingests.js +0 -1
  27. package/src/ingests/components/IngestsActions.js +1 -2
  28. package/src/ingests/components/IngestsLabelResults.js +1 -2
  29. package/src/ingests/components/IngestsLoader.js +1 -1
  30. package/src/ingests/components/IngestsSearch.js +0 -1
  31. package/src/ingests/components/IngestsSelector.js +0 -1
  32. package/src/ingests/components/IngestsTable.js +85 -94
  33. package/src/ingests/components/IngestsTabs.js +2 -3
  34. package/src/ingests/components/__tests__/Events.spec.js +10 -10
  35. package/src/ingests/components/__tests__/Ingest.spec.js +16 -5
  36. package/src/ingests/components/__tests__/IngestActions.spec.js +7 -7
  37. package/src/ingests/components/__tests__/IngestArchive.spec.js +7 -7
  38. package/src/ingests/components/__tests__/IngestArchiveLoader.spec.js +70 -69
  39. package/src/ingests/components/__tests__/IngestArchiveRow.spec.js +10 -12
  40. package/src/ingests/components/__tests__/IngestCompleteness.spec.js +0 -1
  41. package/src/ingests/components/__tests__/IngestDetails.spec.js +10 -10
  42. package/src/ingests/components/__tests__/IngestExecutions.spec.js +7 -7
  43. package/src/ingests/components/__tests__/IngestExecutionsLoader.spec.js +38 -47
  44. package/src/ingests/components/__tests__/IngestFilters.spec.js +0 -1
  45. package/src/ingests/components/__tests__/IngestForm.spec.js +18 -40
  46. package/src/ingests/components/__tests__/IngestHeader.spec.js +9 -9
  47. package/src/ingests/components/__tests__/IngestLabelResults.spec.js +0 -1
  48. package/src/ingests/components/__tests__/IngestLoader.spec.js +70 -41
  49. package/src/ingests/components/__tests__/IngestRoutes.spec.js +176 -0
  50. package/src/ingests/components/__tests__/IngestSelectedFilters.spec.js +33 -5
  51. package/src/ingests/components/__tests__/Ingests.spec.js +32 -6
  52. package/src/ingests/components/__tests__/IngestsActions.spec.js +5 -5
  53. package/src/ingests/components/__tests__/IngestsLoader.spec.js +65 -36
  54. package/src/ingests/components/__tests__/IngestsTable.spec.js +16 -7
  55. package/src/ingests/components/__tests__/__snapshots__/Events.spec.js.snap +83 -43
  56. package/src/ingests/components/__tests__/__snapshots__/Ingest.spec.js.snap +27 -14
  57. package/src/ingests/components/__tests__/__snapshots__/IngestActions.spec.js.snap +19 -20
  58. package/src/ingests/components/__tests__/__snapshots__/IngestArchive.spec.js.snap +79 -65
  59. package/src/ingests/components/__tests__/__snapshots__/IngestArchiveLoader.spec.js.snap +1 -1
  60. package/src/ingests/components/__tests__/__snapshots__/IngestArchiveRow.spec.js.snap +30 -30
  61. package/src/ingests/components/__tests__/__snapshots__/IngestDetails.spec.js.snap +30 -13
  62. package/src/ingests/components/__tests__/__snapshots__/IngestExecutions.spec.js.snap +121 -101
  63. package/src/ingests/components/__tests__/__snapshots__/IngestExecutionsLoader.spec.js.snap +1 -1
  64. package/src/ingests/components/__tests__/__snapshots__/IngestFilters.spec.js.snap +1 -1
  65. package/src/ingests/components/__tests__/__snapshots__/IngestForm.spec.js.snap +28 -27
  66. package/src/ingests/components/__tests__/__snapshots__/IngestHeader.spec.js.snap +21 -19
  67. package/src/ingests/components/__tests__/__snapshots__/IngestLabelResults.spec.js.snap +1 -1
  68. package/src/ingests/components/__tests__/__snapshots__/IngestLoader.spec.js.snap +1 -15
  69. package/src/ingests/components/__tests__/__snapshots__/IngestRoutes.spec.js.snap +243 -0
  70. package/src/ingests/components/__tests__/__snapshots__/IngestSelectedFilters.spec.js.snap +22 -16
  71. package/src/ingests/components/__tests__/__snapshots__/Ingests.spec.js.snap +50 -33
  72. package/src/ingests/components/__tests__/__snapshots__/IngestsActions.spec.js.snap +17 -50
  73. package/src/ingests/components/__tests__/__snapshots__/IngestsLoader.spec.js.snap +1 -21
  74. package/src/ingests/components/__tests__/__snapshots__/IngestsTable.spec.js.snap +15 -24
  75. package/src/ingests/components/index.js +1 -1
  76. package/src/ingests/constants/mappings.js +6 -6
  77. package/src/ingests/relations/components/IngestLinkActions.js +0 -1
  78. package/src/ingests/relations/components/IngestLinksActions.js +1 -2
  79. package/src/ingests/relations/components/IngestRelationsRoutes.js +67 -69
  80. package/src/ingests/relations/components/IngestToDataStructureRelations.js +2 -2
  81. package/src/ingests/relations/components/IngestToIngestForm.js +4 -4
  82. package/src/ingests/relations/components/IngestToIngestRelations.js +4 -4
  83. package/src/ingests/relations/components/IngestToStructureForm.js +6 -6
  84. package/src/ingests/relations/components/__tests__/IngestRelationsRoutes.spec.js +80 -4
  85. package/src/ingests/relations/components/__tests__/IngestToIngestForm.spec.js +24 -25
  86. package/src/ingests/relations/components/__tests__/IngestToStructureForm.spec.js +42 -23
  87. package/src/ingests/relations/components/__tests__/__snapshots__/IngestRelationsRoutes.spec.js.snap +49 -23
  88. package/src/ingests/relations/components/__tests__/__snapshots__/IngestToIngestForm.spec.js.snap +85 -27
  89. package/src/ingests/relations/components/__tests__/__snapshots__/IngestToStructureForm.spec.js.snap +30 -35
  90. package/src/ingests/relations/selectors/__tests__/getIngestLinks.spec.js +20 -20
  91. package/src/ingests/relations/selectors/__tests__/getRelations.spec.js +17 -17
  92. package/src/ingests/relations/selectors/getIngestLinks.js +1 -2
  93. package/src/ingests/relations/selectors/getRelations.js +6 -6
  94. package/src/ingests/sagas/fetchIngest.js +1 -1
  95. package/src/ingests/sagas/fetchIngestArchive.js +1 -1
  96. package/src/ingests/sagas/fetchIngestExecutions.js +1 -1
  97. package/src/ingests/selectors/getIngestColumns.js +12 -13
  98. package/src/ingests/selectors/getIngestTemplate.js +1 -1
  99. package/src/ingests/selectors/getParsedEvents.js +15 -15
  100. package/src/ingests/selectors/getTemplateFields.js +3 -3
  101. package/src/ingests/selectors/getTemplateGroups.js +1 -1
  102. package/src/ingests/utils/filterOptions.js +3 -2
  103. package/src/ingests/components/__tests__/IngestDuplicate.spec.js +0 -67
  104. package/src/ingests/components/__tests__/IngestEdit.spec.js +0 -79
  105. package/src/ingests/components/__tests__/__snapshots__/IngestDuplicate.spec.js.snap +0 -85
  106. package/src/ingests/components/__tests__/__snapshots__/IngestEdit.spec.js.snap +0 -80
@@ -0,0 +1,176 @@
1
+ import React from "react";
2
+ import { render, waitForLoad } from "@truedat/test/render";
3
+ import IngestRoutes from "../IngestRoutes";
4
+ import { useAuthorized } from "@truedat/core/hooks/useAuthorized";
5
+ import {
6
+ INGEST,
7
+ INGEST_ARCHIVE,
8
+ INGEST_DUPLICATE,
9
+ INGEST_EDIT,
10
+ INGEST_EVENTS,
11
+ INGEST_RELATIONS_INGESTS,
12
+ INGEST_RELATIONS_STRUCTURES,
13
+ INGESTS,
14
+ INGESTS_PENDING,
15
+ INGESTS_NEW,
16
+ INGEST_EXECUTIONS,
17
+ } from "@truedat/core/routes";
18
+
19
+ jest.mock("@truedat/core/hooks/useAuthorized", () => ({
20
+ useAuthorized: jest.fn(() => true),
21
+ }));
22
+
23
+ // Mock all child components
24
+ jest.mock("../Ingest", () => () => <div>Ingest</div>);
25
+ jest.mock("../IngestArchive", () => () => <div>IngestArchive</div>);
26
+ jest.mock("../IngestArchiveLoader", () => () => <div>IngestArchiveLoader</div>);
27
+ jest.mock("../IngestCrumbs", () => () => <div>IngestCrumbs</div>);
28
+ jest.mock("../IngestCompleteness", () => () => <div>IngestCompleteness</div>);
29
+ jest.mock("../IngestDetails", () => () => <div>IngestDetails</div>);
30
+ jest.mock("../IngestDuplicate", () => () => <div>IngestDuplicate</div>);
31
+ jest.mock("../IngestEdit", () => () => <div>IngestEdit</div>);
32
+ jest.mock("../IngestExecutions", () => () => <div>IngestExecutions</div>);
33
+ jest.mock("../IngestExecutionsLoader", () => () => (
34
+ <div>IngestExecutionsLoader</div>
35
+ ));
36
+ jest.mock("../IngestFiltersLoader", () => () => <div>IngestFiltersLoader</div>);
37
+ jest.mock("../IngestForm", () => () => <div>IngestForm</div>);
38
+ jest.mock("../IngestLoader", () => () => <div>IngestLoader</div>);
39
+ jest.mock("../IngestSummary", () => () => <div>IngestSummary</div>);
40
+ jest.mock("../Ingests", () => () => <div>Ingests</div>);
41
+ jest.mock("../IngestsLoader", () => () => <div>IngestsLoader</div>);
42
+ jest.mock("../Events", () => () => <div>Events</div>);
43
+ jest.mock("../../relations/components/IngestRelationsRoutes", () => () => (
44
+ <div>IngestRelationsRoutes</div>
45
+ ));
46
+ jest.mock("@truedat/core/components/Comments", () => () => <div>Comments</div>);
47
+ jest.mock("@truedat/core/components/CommentsLoader", () => () => (
48
+ <div>CommentsLoader</div>
49
+ ));
50
+ jest.mock("@truedat/core/router/ProtectedRoute", () => ({ children }) => (
51
+ <div>ProtectedRoute{children}</div>
52
+ ));
53
+ jest.mock("@truedat/core/router/Loader", () => ({ children, loaders }) => (
54
+ <div>
55
+ Loader
56
+ <div>Loaders: {loaders}</div>
57
+ {children}
58
+ </div>
59
+ ));
60
+ jest.mock("@truedat/audit/components/EventsLoader", () => () => (
61
+ <div>EventsLoader</div>
62
+ ));
63
+ jest.mock("@truedat/lm/components/RelationTagsLoader", () => () => (
64
+ <div>RelationTagsLoader</div>
65
+ ));
66
+ jest.mock("@truedat/core/components/TemplatesLoader", () => () => (
67
+ <div>TemplatesLoader</div>
68
+ ));
69
+ jest.mock("@truedat/core/router/Unauthorized", () => () => (
70
+ <div>Unauthorized</div>
71
+ ));
72
+
73
+ describe("<IngestRoutes />", () => {
74
+ it("renders correctly with default route", async () => {
75
+ const rendered = render(<IngestRoutes />);
76
+ await waitForLoad(rendered);
77
+ expect(rendered.container).toMatchSnapshot();
78
+ });
79
+
80
+ it("renders correctly with ingests route", async () => {
81
+ const rendered = render(<IngestRoutes />, {
82
+ routes: [INGESTS],
83
+ });
84
+ await waitForLoad(rendered);
85
+ expect(rendered.container).toMatchSnapshot();
86
+ });
87
+
88
+ it("renders correctly with ingests pending route", async () => {
89
+ const rendered = render(<IngestRoutes />, {
90
+ routes: [INGESTS_PENDING],
91
+ });
92
+ await waitForLoad(rendered);
93
+ expect(rendered.container).toMatchSnapshot();
94
+ });
95
+
96
+ it("renders correctly with ingests new route", async () => {
97
+ const rendered = render(<IngestRoutes />, {
98
+ routes: [INGESTS_NEW],
99
+ });
100
+ await waitForLoad(rendered);
101
+ expect(rendered.container).toMatchSnapshot();
102
+ });
103
+
104
+ it("renders correctly with ingest route", async () => {
105
+ const rendered = render(<IngestRoutes />, {
106
+ routes: [INGEST.replace(":id", "123")],
107
+ });
108
+ await waitForLoad(rendered);
109
+ expect(rendered.container).toMatchSnapshot();
110
+ });
111
+
112
+ it("renders correctly with ingest executions route", async () => {
113
+ const rendered = render(<IngestRoutes />, {
114
+ routes: [INGEST_EXECUTIONS.replace(":id", "123")],
115
+ });
116
+ await waitForLoad(rendered);
117
+ expect(rendered.container).toMatchSnapshot();
118
+ });
119
+
120
+ it("renders correctly with ingest archive route", async () => {
121
+ const rendered = render(<IngestRoutes />, {
122
+ routes: [INGEST_ARCHIVE.replace(":id", "123")],
123
+ });
124
+ await waitForLoad(rendered);
125
+ expect(rendered.container).toMatchSnapshot();
126
+ });
127
+
128
+ it("renders correctly with ingest events route", async () => {
129
+ const rendered = render(<IngestRoutes />, {
130
+ routes: [INGEST_EVENTS.replace(":id", "123")],
131
+ });
132
+ await waitForLoad(rendered);
133
+ expect(rendered.container).toMatchSnapshot();
134
+ });
135
+
136
+ it("renders correctly with ingest relations structures route", async () => {
137
+ const rendered = render(<IngestRoutes />, {
138
+ routes: [INGEST_RELATIONS_STRUCTURES.replace(":id", "123")],
139
+ });
140
+ await waitForLoad(rendered);
141
+ expect(rendered.container).toMatchSnapshot();
142
+ });
143
+
144
+ it("renders correctly with ingest relations ingests route", async () => {
145
+ const rendered = render(<IngestRoutes />, {
146
+ routes: [INGEST_RELATIONS_INGESTS.replace(":id", "123")],
147
+ });
148
+ await waitForLoad(rendered);
149
+ expect(rendered.container).toMatchSnapshot();
150
+ });
151
+
152
+ it("renders correctly with ingest edit route", async () => {
153
+ const rendered = render(<IngestRoutes />, {
154
+ routes: [INGEST_EDIT.replace(":id", "123")],
155
+ });
156
+ await waitForLoad(rendered);
157
+ expect(rendered.container).toMatchSnapshot();
158
+ });
159
+
160
+ it("renders correctly with ingest duplicate route", async () => {
161
+ const rendered = render(<IngestRoutes />, {
162
+ routes: [INGEST_DUPLICATE.replace(":id", "123")],
163
+ });
164
+ await waitForLoad(rendered);
165
+ expect(rendered.container).toMatchSnapshot();
166
+ });
167
+
168
+ it("renders unauthorized component when not authorized", async () => {
169
+ useAuthorized.mockReturnValueOnce(false);
170
+ const rendered = render(<IngestRoutes />, {
171
+ routes: [INGESTS],
172
+ });
173
+ await waitForLoad(rendered);
174
+ expect(rendered.container).toMatchSnapshot();
175
+ });
176
+ });
@@ -1,10 +1,38 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestSelectedFilters } from "../IngestSelectedFilters";
3
+ import { INGESTS, INGESTS_PENDING } from "@truedat/core/routes";
4
+
5
+ // Mock all child components used in routes
6
+ jest.mock("../IngestSelectedFiltersDefault", () => () => (
7
+ <div>IngestSelectedFiltersDefault</div>
8
+ ));
9
+ jest.mock("../IngestSelectedFiltersPending", () => () => (
10
+ <div>IngestSelectedFiltersPending</div>
11
+ ));
12
+ jest.mock("../IngestSelectedFiltersPublished", () => () => (
13
+ <div>IngestSelectedFiltersPublished</div>
14
+ ));
4
15
 
5
16
  describe("<IngestSelectedFilters />", () => {
6
- it("matches the latest snapshot", () => {
7
- const wrapper = shallow(<IngestSelectedFilters />);
8
- expect(wrapper).toMatchSnapshot();
17
+ it("renders correctly with default route", async () => {
18
+ const rendered = render(<IngestSelectedFilters />);
19
+ await waitForLoad(rendered);
20
+ expect(rendered.container).toMatchSnapshot();
21
+ });
22
+
23
+ it("renders correctly with ingests route", async () => {
24
+ const rendered = render(<IngestSelectedFilters />, {
25
+ routes: [INGESTS],
26
+ });
27
+ await waitForLoad(rendered);
28
+ expect(rendered.container).toMatchSnapshot();
29
+ });
30
+
31
+ it("renders correctly with ingests pending route", async () => {
32
+ const rendered = render(<IngestSelectedFilters />, {
33
+ routes: [INGESTS_PENDING],
34
+ });
35
+ await waitForLoad(rendered);
36
+ expect(rendered.container).toMatchSnapshot();
9
37
  });
10
38
  });
@@ -1,14 +1,40 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { Ingests } from "../Ingests";
4
3
 
4
+ // Mock the imported components
5
+ jest.mock("../IngestCrumbs", () => () => (
6
+ <div data-testid="mock-ingest-crumbs" />
7
+ ));
8
+ jest.mock("../IngestSelectedFilters", () => () => (
9
+ <div data-testid="mock-ingest-selected-filters" />
10
+ ));
11
+ jest.mock("../IngestsActions", () => () => (
12
+ <div data-testid="mock-ingests-actions" />
13
+ ));
14
+ jest.mock("../IngestsLabelResults", () => () => (
15
+ <div data-testid="mock-ingests-label-results" />
16
+ ));
17
+ jest.mock("../IngestsPagination", () => () => (
18
+ <div data-testid="mock-ingests-pagination" />
19
+ ));
20
+ jest.mock("../IngestsSearch", () => () => (
21
+ <div data-testid="mock-ingests-search" />
22
+ ));
23
+ jest.mock("../IngestsTable", () => () => (
24
+ <div data-testid="mock-ingests-table" />
25
+ ));
26
+ jest.mock("../IngestsTabs", () => () => (
27
+ <div data-testid="mock-ingests-tabs" />
28
+ ));
29
+
5
30
  describe("<Ingests />", () => {
6
- it("matches the latest snapshot", () => {
31
+ it("matches the latest snapshot", async () => {
7
32
  const ingests = [
8
- { id: 1, name: "s1", description: "dd", version: "vs", status: "st" }
33
+ { id: 1, name: "s1", description: "dd", version: "vs", status: "st" },
9
34
  ];
10
35
  const props = { ingests };
11
- const wrapper = shallow(<Ingests {...props} />);
12
- expect(wrapper).toMatchSnapshot();
36
+ const rendered = render(<Ingests {...props} />);
37
+ await waitForLoad(rendered);
38
+ expect(rendered.container).toMatchSnapshot();
13
39
  });
14
40
  });
@@ -1,12 +1,12 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestsActions } from "../IngestsActions";
4
3
 
5
4
  describe("<IngestsActions />", () => {
6
5
  const props = { createUrl: "/url/to/create/ingest" };
7
6
 
8
- it("matches the latest snapshot", () => {
9
- const wrapper = shallow(<IngestsActions {...props} />);
10
- expect(wrapper).toMatchSnapshot();
7
+ it("matches the latest snapshot", async () => {
8
+ const rendered = render(<IngestsActions {...props} />);
9
+ await waitForLoad(rendered);
10
+ expect(rendered.container).toMatchSnapshot();
11
11
  });
12
12
  });
@@ -1,52 +1,81 @@
1
- import React from "react";
2
- import { mount, shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestsLoader } from "../IngestsLoader";
4
3
 
5
- const getProps = () => ({
6
- clearIngests: jest.fn(),
7
- loading: false,
8
- fetchIngests: jest.fn(),
9
- });
10
-
11
4
  describe("<IngestsLoader />", () => {
12
- it("matches the latest snapshot", () => {
13
- const props = getProps();
14
- const wrapper = mount(<IngestsLoader {...props} />);
15
- expect(wrapper).toMatchSnapshot();
5
+ const clearIngests = jest.fn();
6
+ const fetchIngests = jest.fn();
7
+
8
+ it("matches the latest snapshot", async () => {
9
+ const props = {
10
+ clearIngests,
11
+ fetchIngests,
12
+ loading: false,
13
+ };
14
+ const rendered = render(<IngestsLoader {...props} />);
15
+ await waitForLoad(rendered);
16
+ expect(rendered.container).toMatchSnapshot();
16
17
  });
17
18
 
18
- it("renders a loader if ingestLoading is true", () => {
19
- const props = getProps();
20
- const wrapper = mount(<IngestsLoader {...props} loading />);
21
- expect(wrapper.find("Loading").length).toBe(1);
19
+ it("renders a loader if ingestLoading is true", async () => {
20
+ const props = {
21
+ clearIngests,
22
+ fetchIngests,
23
+ loading: true,
24
+ };
25
+ const rendered = render(<IngestsLoader {...props} />);
26
+ expect(rendered.container.querySelector(".loader")).toBeInTheDocument();
22
27
  });
23
28
 
24
- it("renders null if ingestLoading is false", () => {
25
- const props = getProps();
26
- const wrapper = shallow(<IngestsLoader {...props} />);
27
- expect(wrapper.getElement()).toBeNull();
29
+ it("renders null if ingestLoading is false", async () => {
30
+ const props = {
31
+ clearIngests,
32
+ fetchIngests,
33
+ loading: false,
34
+ };
35
+ const rendered = render(<IngestsLoader {...props} />);
36
+ await waitForLoad(rendered);
37
+ expect(rendered.container.firstChild).toBeNull();
28
38
  });
29
39
 
30
- it("calls fetchIngests when component mounts but not when it unmounts", () => {
31
- const props = getProps();
32
- const wrapper = mount(<IngestsLoader {...props} />);
33
- expect(props.fetchIngests).toHaveBeenCalledTimes(1);
34
- wrapper.unmount();
35
- expect(props.fetchIngests).toHaveBeenCalledTimes(1);
40
+ it("calls fetchIngests when component mounts but not when it unmounts", async () => {
41
+ const fetchIngestsMock = jest.fn();
42
+ const props = {
43
+ clearIngests,
44
+ fetchIngests: fetchIngestsMock,
45
+ loading: false,
46
+ };
47
+ const rendered = render(<IngestsLoader {...props} />);
48
+ await waitForLoad(rendered);
49
+ expect(fetchIngestsMock).toHaveBeenCalledTimes(1);
50
+ rendered.unmount();
51
+ expect(fetchIngestsMock).toHaveBeenCalledTimes(1);
36
52
  });
37
53
 
38
- it("calls clearIngests when component unmounts but not when it mounts", () => {
39
- const props = getProps();
40
- const wrapper = mount(<IngestsLoader {...props} />);
41
- expect(props.clearIngests).toHaveBeenCalledTimes(0);
42
- wrapper.unmount();
43
- expect(props.clearIngests).toHaveBeenCalledTimes(1);
54
+ it("calls clearIngests when component unmounts but not when it mounts", async () => {
55
+ const clearIngestsMock = jest.fn();
56
+ const props = {
57
+ clearIngests: clearIngestsMock,
58
+ fetchIngests,
59
+ loading: false,
60
+ };
61
+ const rendered = render(<IngestsLoader {...props} />);
62
+ await waitForLoad(rendered);
63
+ expect(clearIngestsMock).toHaveBeenCalledTimes(0);
64
+ rendered.unmount();
65
+ expect(clearIngestsMock).toHaveBeenCalledTimes(1);
44
66
  });
45
67
 
46
- it("merges default filters with query filters", () => {
47
- const props = getProps();
68
+ it("merges default filters with query filters", async () => {
69
+ const fetchIngestsMock = jest.fn();
48
70
  const payload = { foo: "foo" };
49
- mount(<IngestsLoader payload={payload} {...props} />);
50
- expect(props.fetchIngests).toHaveBeenCalledWith(payload);
71
+ const props = {
72
+ clearIngests,
73
+ fetchIngests: fetchIngestsMock,
74
+ loading: false,
75
+ payload,
76
+ };
77
+ const rendered = render(<IngestsLoader {...props} />);
78
+ await waitForLoad(rendered);
79
+ expect(fetchIngestsMock).toHaveBeenCalledWith(payload);
51
80
  });
52
81
  });
@@ -1,13 +1,22 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestsTable } from "../IngestsTable";
4
3
 
5
4
  describe("<IngestsTable />", () => {
6
- it("matches the latest snapshot", () => {
7
- const columns = ["name", "status"].map(name => ({ name }));
5
+ it("matches the latest snapshot", async () => {
6
+ const columns = ["name", "status"].map((name) => ({ name }));
8
7
  const ingests = [{ id: 1 }];
9
- const props = { columns, ingests };
10
- const wrapper = shallow(<IngestsTable {...props} />);
11
- expect(wrapper).toMatchSnapshot();
8
+
9
+ const renderOpts = {
10
+ state: {
11
+ ingestsLoading: false,
12
+ ingestQuery: { sort: {} },
13
+ ingestsColumns: columns,
14
+ ingests: ingests,
15
+ },
16
+ };
17
+
18
+ const rendered = render(<IngestsTable />, renderOpts);
19
+ await waitForLoad(rendered);
20
+ expect(rendered.container).toMatchSnapshot();
12
21
  });
13
22
  });
@@ -1,48 +1,88 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Events /> matches the latest snapshot 1`] = `
4
- <Segment
5
- attached="bottom"
6
- >
7
- <Feed
8
- size="small"
4
+ <div>
5
+ <div
6
+ class="ui bottom attached segment"
9
7
  >
10
- <EventRow
11
- id={1}
12
- key="0"
13
- payload={
14
- [
15
- {
16
- "field": "Ou",
17
- "value": 5,
18
- },
19
- {
20
- "field": "id",
21
- "value": 6,
22
- },
23
- ]
24
- }
25
- resource_id={2}
26
- service="My invented service 1"
27
- />
28
- <EventRow
29
- id={2}
30
- key="1"
31
- payload={
32
- [
33
- {
34
- "field": "Ou",
35
- "value": 7,
36
- },
37
- {
38
- "field": "id",
39
- "value": 3,
40
- },
41
- ]
42
- }
43
- resource_id={2}
44
- service="My invented service 2"
45
- />
46
- </Feed>
47
- </Segment>
8
+ <div
9
+ class="ui small feed"
10
+ >
11
+ <div
12
+ class="event"
13
+ >
14
+ <div
15
+ class="content"
16
+ >
17
+ <div
18
+ class="summary"
19
+ >
20
+ <a
21
+ class="user"
22
+ />
23
+
24
+ ingest.events.undefined
25
+
26
+ <div
27
+ class="date"
28
+ >
29
+ <time
30
+ datetime="1735689600000"
31
+ >
32
+ a few seconds ago
33
+ </time>
34
+ </div>
35
+ </div>
36
+ <div
37
+ class="text extra"
38
+ >
39
+ ingest.events.extra.undefined
40
+ </div>
41
+ <div
42
+ class="text extra"
43
+ >
44
+ ingest.events.extra.undefined
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <div
49
+ class="event"
50
+ >
51
+ <div
52
+ class="content"
53
+ >
54
+ <div
55
+ class="summary"
56
+ >
57
+ <a
58
+ class="user"
59
+ />
60
+
61
+ ingest.events.undefined
62
+
63
+ <div
64
+ class="date"
65
+ >
66
+ <time
67
+ datetime="1735689600000"
68
+ >
69
+ a few seconds ago
70
+ </time>
71
+ </div>
72
+ </div>
73
+ <div
74
+ class="text extra"
75
+ >
76
+ ingest.events.extra.undefined
77
+ </div>
78
+ <div
79
+ class="text extra"
80
+ >
81
+ ingest.events.extra.undefined
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
48
88
  `;
@@ -1,20 +1,33 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Ingest /> matches the latest snapshot 1`] = `
4
- <Fragment>
5
- <Grid>
6
- <GridColumn
7
- width={8}
4
+ <div>
5
+ <div
6
+ class="ui grid"
7
+ >
8
+ <div
9
+ class="eight wide column"
8
10
  >
9
- <Connect(IngestHeader) />
10
- </GridColumn>
11
- <GridColumn
12
- textAlign="right"
13
- width={8}
11
+ <div
12
+ data-testid="ingest-header"
13
+ >
14
+ IngestHeader Mock
15
+ </div>
16
+ </div>
17
+ <div
18
+ class="right aligned eight wide column"
14
19
  >
15
- <Connect(IngestActions) />
16
- </GridColumn>
17
- </Grid>
18
- <Connect(IngestTabs) />
19
- </Fragment>
20
+ <div
21
+ data-testid="ingest-actions"
22
+ >
23
+ IngestActions Mock
24
+ </div>
25
+ </div>
26
+ </div>
27
+ <div
28
+ data-testid="ingest-tabs"
29
+ >
30
+ IngestTabs Mock
31
+ </div>
32
+ </div>
20
33
  `;
@@ -1,25 +1,24 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<IngestActions /> matches the latest snapshot 1`] = `
4
- <Grid>
5
- <GridColumn
6
- textAlign="right"
7
- width={16}
4
+ <div>
5
+ <div
6
+ class="ui grid"
8
7
  >
9
- <IngestAction
10
- action="action1"
11
- doAction={[MockFunction]}
12
- href="/api/action1"
13
- key="action1"
14
- method="POST"
15
- />
16
- <IngestAction
17
- action="action2"
18
- doAction={[MockFunction]}
19
- href="/api/action2"
20
- key="action2"
21
- method="GET"
22
- />
23
- </GridColumn>
24
- </Grid>
8
+ <div
9
+ class="right aligned sixteen wide column"
10
+ >
11
+ <button
12
+ class="ui button"
13
+ >
14
+ action1
15
+ </button>
16
+ <button
17
+ class="ui button"
18
+ >
19
+ action2
20
+ </button>
21
+ </div>
22
+ </div>
23
+ </div>
25
24
  `;