@truedat/bg 7.5.8 → 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 (236) hide show
  1. package/package.json +41 -70
  2. package/src/concepts/components/Concept.js +22 -19
  3. package/src/concepts/components/ConceptActions.js +1 -2
  4. package/src/concepts/components/ConceptArchive.js +0 -1
  5. package/src/concepts/components/ConceptArchiveRow.js +3 -4
  6. package/src/concepts/components/ConceptCompleteness.js +1 -2
  7. package/src/concepts/components/ConceptConfidentialButton.js +1 -2
  8. package/src/concepts/components/ConceptCreate.js +1 -1
  9. package/src/concepts/components/ConceptCrumbs.js +10 -8
  10. package/src/concepts/components/ConceptDeleteModalBody.js +7 -10
  11. package/src/concepts/components/ConceptDetails.js +3 -3
  12. package/src/concepts/components/ConceptEdit.js +2 -2
  13. package/src/concepts/components/ConceptForm.js +39 -43
  14. package/src/concepts/components/ConceptHeader.js +0 -1
  15. package/src/concepts/components/ConceptLinksDropdownSelector.js +1 -2
  16. package/src/concepts/components/ConceptLoader.js +3 -3
  17. package/src/concepts/components/ConceptManageDomain.js +2 -1
  18. package/src/concepts/components/ConceptManageDomainPopup.js +1 -1
  19. package/src/concepts/components/ConceptRoutes.js +263 -226
  20. package/src/concepts/components/ConceptRow.js +0 -1
  21. package/src/concepts/components/ConceptSubscription.js +15 -14
  22. package/src/concepts/components/ConceptSummary.js +0 -1
  23. package/src/concepts/components/ConceptTabPane.js +36 -41
  24. package/src/concepts/components/ConceptTabs.js +1 -4
  25. package/src/concepts/components/ConceptTaxonomy.js +1 -3
  26. package/src/concepts/components/Concepts.js +0 -1
  27. package/src/concepts/components/ConceptsActions.js +2 -3
  28. package/src/concepts/components/ConceptsBulkUpdate.js +3 -6
  29. package/src/concepts/components/ConceptsLabelResults.js +0 -1
  30. package/src/concepts/components/ConceptsLinkDecorator.js +1 -2
  31. package/src/concepts/components/ConceptsLinksManagement.js +7 -8
  32. package/src/concepts/components/ConceptsPagination.js +0 -1
  33. package/src/concepts/components/ConceptsPanel.js +5 -4
  34. package/src/concepts/components/ConceptsTable.js +2 -3
  35. package/src/concepts/components/ConceptsUpdateButton.js +6 -6
  36. package/src/concepts/components/ConceptsUploadButton.js +0 -1
  37. package/src/concepts/components/ConceptsUploadEvents.js +0 -2
  38. package/src/concepts/components/ConceptsUploadEventsTable.js +12 -19
  39. package/src/concepts/components/DomainConcepts.js +0 -1
  40. package/src/concepts/components/EventRow.js +0 -1
  41. package/src/concepts/components/Events.js +3 -4
  42. package/src/concepts/components/FieldGroupTable.js +1 -2
  43. package/src/concepts/components/LinkedMessage.js +9 -13
  44. package/src/concepts/components/SharedToDomains.js +8 -7
  45. package/src/concepts/components/SharedToDomainsPopup.js +1 -1
  46. package/src/concepts/components/SharedToForm.js +3 -6
  47. package/src/concepts/components/__tests__/Concept.spec.js +8 -42
  48. package/src/concepts/components/__tests__/ConceptActions.spec.js +7 -7
  49. package/src/concepts/components/__tests__/ConceptArchive.spec.js +5 -5
  50. package/src/concepts/components/__tests__/ConceptArchiveLoader.spec.js +15 -14
  51. package/src/concepts/components/__tests__/ConceptArchiveRow.spec.js +0 -1
  52. package/src/concepts/components/__tests__/ConceptCompleteness.spec.js +0 -1
  53. package/src/concepts/components/__tests__/ConceptConfidentialButton.spec.js +10 -17
  54. package/src/concepts/components/__tests__/ConceptContext.spec.js +1 -1
  55. package/src/concepts/components/__tests__/ConceptCrumbs.spec.js +12 -34
  56. package/src/concepts/components/__tests__/ConceptDeleteModalBody.spec.js +47 -26
  57. package/src/concepts/components/__tests__/ConceptDetails.spec.js +1 -9
  58. package/src/concepts/components/__tests__/ConceptEdit.spec.js +2 -2
  59. package/src/concepts/components/__tests__/ConceptForm.spec.js +26 -19
  60. package/src/concepts/components/__tests__/ConceptHeader.spec.js +33 -57
  61. package/src/concepts/components/__tests__/ConceptLinksManagement.spec.js +27 -34
  62. package/src/concepts/components/__tests__/ConceptLoader.spec.js +51 -37
  63. package/src/concepts/components/__tests__/ConceptManageDomain.spec.js +12 -47
  64. package/src/concepts/components/__tests__/ConceptManageDomainPopup.spec.js +65 -24
  65. package/src/concepts/components/__tests__/ConceptRow.spec.js +6 -17
  66. package/src/concepts/components/__tests__/ConceptSubscription.spec.js +9 -9
  67. package/src/concepts/components/__tests__/ConceptSubscriptionLoader.spec.js +20 -16
  68. package/src/concepts/components/__tests__/ConceptSummary.spec.js +11 -10
  69. package/src/concepts/components/__tests__/ConceptTabPane.spec.js +73 -5
  70. package/src/concepts/components/__tests__/ConceptTabs.spec.js +6 -21
  71. package/src/concepts/components/__tests__/ConceptTaxonomy.spec.js +16 -12
  72. package/src/concepts/components/__tests__/Concepts.spec.js +6 -26
  73. package/src/concepts/components/__tests__/ConceptsActions.spec.js +0 -1
  74. package/src/concepts/components/__tests__/ConceptsBulkUpdate.spec.js +31 -36
  75. package/src/concepts/components/__tests__/ConceptsLabelResults.spec.js +4 -5
  76. package/src/concepts/components/__tests__/ConceptsLinkDecorator.spec.js +3 -4
  77. package/src/concepts/components/__tests__/ConceptsPanel.spec.js +7 -26
  78. package/src/concepts/components/__tests__/ConceptsTable.spec.js +34 -60
  79. package/src/concepts/components/__tests__/ConceptsUpdateButton.spec.js +6 -7
  80. package/src/concepts/components/__tests__/ConceptsUploadButton.spec.js +25 -13
  81. package/src/concepts/components/__tests__/ConceptsUploadEventsTable.spec.js +11 -9
  82. package/src/concepts/components/__tests__/Events.spec.js +10 -10
  83. package/src/concepts/components/__tests__/SharedToDomains.spec.js +25 -19
  84. package/src/concepts/components/__tests__/SharedToDomainsPopup.spec.js +48 -36
  85. package/src/concepts/components/__tests__/SharedToForm.spec.js +24 -32
  86. package/src/concepts/components/__tests__/__snapshots__/Concept.spec.js.snap +108 -23
  87. package/src/concepts/components/__tests__/__snapshots__/ConceptActions.spec.js.snap +12 -16
  88. package/src/concepts/components/__tests__/__snapshots__/ConceptArchive.spec.js.snap +77 -65
  89. package/src/concepts/components/__tests__/__snapshots__/ConceptArchiveRow.spec.js.snap +2 -4
  90. package/src/concepts/components/__tests__/__snapshots__/ConceptConfidentialButton.spec.js.snap +11 -31
  91. package/src/concepts/components/__tests__/__snapshots__/ConceptCrumbs.spec.js.snap +41 -56
  92. package/src/concepts/components/__tests__/__snapshots__/ConceptDeleteModalBody.spec.js.snap +3 -5
  93. package/src/concepts/components/__tests__/__snapshots__/ConceptDetails.spec.js.snap +0 -1
  94. package/src/concepts/components/__tests__/__snapshots__/ConceptEdit.spec.js.snap +1 -12
  95. package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +10 -11
  96. package/src/concepts/components/__tests__/__snapshots__/ConceptHeader.spec.js.snap +2 -2
  97. package/src/concepts/components/__tests__/__snapshots__/ConceptLinksManagement.spec.js.snap +14 -14
  98. package/src/concepts/components/__tests__/__snapshots__/ConceptLoader.spec.js.snap +14 -9
  99. package/src/concepts/components/__tests__/__snapshots__/ConceptManageDomain.spec.js.snap +43 -5
  100. package/src/concepts/components/__tests__/__snapshots__/ConceptManageDomainPopup.spec.js.snap +10 -163
  101. package/src/concepts/components/__tests__/__snapshots__/ConceptRow.spec.js.snap +4 -7
  102. package/src/concepts/components/__tests__/__snapshots__/ConceptSubscription.spec.js.snap +8 -55
  103. package/src/concepts/components/__tests__/__snapshots__/ConceptSubscriptionLoader.spec.js.snap +1 -1
  104. package/src/concepts/components/__tests__/__snapshots__/ConceptSummary.spec.js.snap +6 -6
  105. package/src/concepts/components/__tests__/__snapshots__/ConceptTabPane.spec.js.snap +18 -34
  106. package/src/concepts/components/__tests__/__snapshots__/ConceptTabs.spec.js.snap +26 -13
  107. package/src/concepts/components/__tests__/__snapshots__/ConceptTaxonomy.spec.js.snap +63 -53
  108. package/src/concepts/components/__tests__/__snapshots__/Concepts.spec.js.snap +10 -25
  109. package/src/concepts/components/__tests__/__snapshots__/ConceptsActions.spec.js.snap +1 -0
  110. package/src/concepts/components/__tests__/__snapshots__/ConceptsBulkUpdate.spec.js.snap +7 -6
  111. package/src/concepts/components/__tests__/__snapshots__/ConceptsLabelResults.spec.js.snap +1 -1
  112. package/src/concepts/components/__tests__/__snapshots__/ConceptsLinkDecorator.spec.js.snap +1 -0
  113. package/src/concepts/components/__tests__/__snapshots__/ConceptsPanel.spec.js.snap +10 -25
  114. package/src/concepts/components/__tests__/__snapshots__/ConceptsTable.spec.js.snap +1 -1
  115. package/src/concepts/components/__tests__/__snapshots__/ConceptsUpdateButton.spec.js.snap +1 -1
  116. package/src/concepts/components/__tests__/__snapshots__/ConceptsUploadButton.spec.js.snap +9 -74
  117. package/src/concepts/components/__tests__/__snapshots__/ConceptsUploadEventsTable.spec.js.snap +14 -14
  118. package/src/concepts/components/__tests__/__snapshots__/Events.spec.js.snap +83 -43
  119. package/src/concepts/components/__tests__/__snapshots__/SharedToDomains.spec.js.snap +56 -33
  120. package/src/concepts/components/__tests__/__snapshots__/SharedToDomainsPopup.spec.js.snap +9 -145
  121. package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +2 -2
  122. package/src/concepts/reducers/__tests__/conceptRedirect.spec.js +1 -1
  123. package/src/concepts/reducers/conceptRedirect.js +5 -5
  124. package/src/concepts/relations/components/ConceptImplementationLinks.js +5 -4
  125. package/src/concepts/relations/components/ConceptLinkActions.js +1 -1
  126. package/src/concepts/relations/components/ConceptLinksActions.js +4 -4
  127. package/src/concepts/relations/components/ConceptRelationActions.js +3 -4
  128. package/src/concepts/relations/components/ConceptRelationForm.js +3 -3
  129. package/src/concepts/relations/components/ConceptRelationRow.js +10 -10
  130. package/src/concepts/relations/components/ConceptRelations.js +9 -11
  131. package/src/concepts/relations/components/ConceptRelationsRoutes.js +20 -39
  132. package/src/concepts/relations/components/ConceptRelationsSummary.js +26 -29
  133. package/src/concepts/relations/components/ConceptSelector.js +4 -7
  134. package/src/concepts/relations/components/ConceptStructureLinks.js +2 -2
  135. package/src/concepts/relations/components/__tests__/ConceptImplementationLinks.spec.js +19 -59
  136. package/src/concepts/relations/components/__tests__/ConceptLinksActions.spec.js +9 -10
  137. package/src/concepts/relations/components/__tests__/ConceptRelationActions.spec.js +9 -7
  138. package/src/concepts/relations/components/__tests__/ConceptRelationForm.spec.js +30 -42
  139. package/src/concepts/relations/components/__tests__/ConceptRelationRow.spec.js +11 -16
  140. package/src/concepts/relations/components/__tests__/ConceptRelations.spec.js +11 -14
  141. package/src/concepts/relations/components/__tests__/ConceptRelationsRoutes.spec.js +108 -8
  142. package/src/concepts/relations/components/__tests__/ConceptRelationsSummary.spec.js +39 -38
  143. package/src/concepts/relations/components/__tests__/ConceptSelector.spec.js +24 -36
  144. package/src/concepts/relations/components/__tests__/ConceptStructureLinks.spec.js +21 -11
  145. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptImplementationLinks.spec.js.snap +131 -28
  146. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksActions.spec.js.snap +4 -3
  147. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationActions.spec.js.snap +10 -26
  148. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationForm.spec.js.snap +15 -19
  149. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationRow.spec.js.snap +36 -33
  150. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelations.spec.js.snap +76 -51
  151. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationsRoutes.spec.js.snap +15 -29
  152. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationsSummary.spec.js.snap +45 -100
  153. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptSelector.spec.js.snap +9 -9
  154. package/src/concepts/relations/components/__tests__/__snapshots__/ConceptStructureLinks.spec.js.snap +10 -10
  155. package/src/concepts/relations/sagas/conceptLinkAction.js +2 -2
  156. package/src/concepts/relations/sagas/linkConcept.js +1 -1
  157. package/src/concepts/relations/selectors/getBusinessConceptsLinksToImplementationsColumns.js +1 -2
  158. package/src/concepts/relations/selectors/getConceptLinks.js +1 -2
  159. package/src/concepts/relations/selectors/getConceptRelations.js +14 -14
  160. package/src/concepts/sagas/__tests__/saveSharedTo.spec.js +3 -3
  161. package/src/concepts/sagas/__tests__/setConfidentialConcept.spec.js +5 -5
  162. package/src/concepts/sagas/conceptAction.js +2 -2
  163. package/src/concepts/sagas/fetchConceptArchive.js +1 -1
  164. package/src/concepts/sagas/setConfidentialConcept.js +2 -2
  165. package/src/concepts/selectors/__tests__/getConceptDomainPath.spec.js +2 -2
  166. package/src/concepts/selectors/getConceptColumns.js +1 -2
  167. package/src/concepts/selectors/getConceptTemplate.js +1 -1
  168. package/src/concepts/selectors/getConceptUploadEventColumns.js +0 -1
  169. package/src/concepts/selectors/getConceptVersionPath.js +2 -2
  170. package/src/concepts/selectors/getParsedEvents.js +2 -2
  171. package/src/concepts/selectors/getTemplateFields.js +3 -3
  172. package/src/concepts/selectors/getTemplateGroups.js +1 -1
  173. package/src/hooks/__mocks__/useDomains.js +42 -0
  174. package/src/hooks/useDomains.js +3 -3
  175. package/src/taxonomy/components/AddDomainMember.js +3 -4
  176. package/src/taxonomy/components/Domain.js +19 -23
  177. package/src/taxonomy/components/DomainActions.js +1 -2
  178. package/src/taxonomy/components/DomainCards.js +4 -6
  179. package/src/taxonomy/components/DomainContent.js +42 -87
  180. package/src/taxonomy/components/DomainCrumbs.js +4 -4
  181. package/src/taxonomy/components/DomainDetail.js +4 -5
  182. package/src/taxonomy/components/DomainForm.js +1 -3
  183. package/src/taxonomy/components/DomainImplementations.js +8 -7
  184. package/src/taxonomy/components/DomainItem.js +1 -2
  185. package/src/taxonomy/components/DomainMembers.js +0 -1
  186. package/src/taxonomy/components/DomainRoutes.js +15 -21
  187. package/src/taxonomy/components/DomainSearch.js +0 -1
  188. package/src/taxonomy/components/DomainStructures.js +0 -1
  189. package/src/taxonomy/components/DomainTabs.js +3 -4
  190. package/src/taxonomy/components/DomainTaxonomy.js +1 -2
  191. package/src/taxonomy/components/Domains.js +15 -5
  192. package/src/taxonomy/components/DomainsActions.js +2 -4
  193. package/src/taxonomy/components/EditDomain.js +5 -5
  194. package/src/taxonomy/components/NewDomain.js +4 -4
  195. package/src/taxonomy/components/__tests__/AddDomainMember.spec.js +6 -5
  196. package/src/taxonomy/components/__tests__/Domain.spec.js +63 -123
  197. package/src/taxonomy/components/__tests__/DomainActions.spec.js +0 -1
  198. package/src/taxonomy/components/__tests__/DomainCards.spec.js +44 -51
  199. package/src/taxonomy/components/__tests__/DomainContent.spec.js +138 -158
  200. package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +14 -19
  201. package/src/taxonomy/components/__tests__/DomainDetail.spec.js +2 -3
  202. package/src/taxonomy/components/__tests__/DomainForm.spec.js +44 -60
  203. package/src/taxonomy/components/__tests__/DomainItem.spec.js +17 -14
  204. package/src/taxonomy/components/__tests__/DomainMembers.spec.js +9 -13
  205. package/src/taxonomy/components/__tests__/DomainRoutes.spec.js +54 -0
  206. package/src/taxonomy/components/__tests__/DomainStructures.spec.js +10 -51
  207. package/src/taxonomy/components/__tests__/DomainTabs.spec.js +14 -33
  208. package/src/taxonomy/components/__tests__/DomainTaxonomy.spec.js +17 -16
  209. package/src/taxonomy/components/__tests__/Domains.spec.js +63 -95
  210. package/src/taxonomy/components/__tests__/DomainsActions.spec.js +12 -11
  211. package/src/taxonomy/components/__tests__/EditDomain.spec.js +13 -54
  212. package/src/taxonomy/components/__tests__/NewDomain.spec.js +17 -61
  213. package/src/taxonomy/components/__tests__/__snapshots__/AddDomainMember.spec.js.snap +10 -9
  214. package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +53 -72
  215. package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +2 -1
  216. package/src/taxonomy/components/__tests__/__snapshots__/DomainCards.spec.js.snap +247 -27
  217. package/src/taxonomy/components/__tests__/__snapshots__/DomainContent.spec.js.snap +14 -294
  218. package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +6 -2
  219. package/src/taxonomy/components/__tests__/__snapshots__/DomainDetail.spec.js.snap +5 -4
  220. package/src/taxonomy/components/__tests__/__snapshots__/DomainForm.spec.js.snap +13 -12
  221. package/src/taxonomy/components/__tests__/__snapshots__/DomainItem.spec.js.snap +16 -12
  222. package/src/taxonomy/components/__tests__/__snapshots__/DomainRoutes.spec.js.snap +52 -0
  223. package/src/taxonomy/components/__tests__/__snapshots__/DomainStructures.spec.js.snap +7 -7
  224. package/src/taxonomy/components/__tests__/__snapshots__/DomainTabs.spec.js.snap +10 -5
  225. package/src/taxonomy/components/__tests__/__snapshots__/DomainTaxonomy.spec.js.snap +37 -29
  226. package/src/taxonomy/components/__tests__/__snapshots__/Domains.spec.js.snap +123 -6
  227. package/src/taxonomy/components/__tests__/__snapshots__/DomainsActions.spec.js.snap +2 -1
  228. package/src/taxonomy/components/__tests__/__snapshots__/EditDomain.spec.js.snap +15 -14
  229. package/src/taxonomy/components/__tests__/__snapshots__/NewDomain.spec.js.snap +31 -28
  230. package/src/taxonomy/selectors/index.js +0 -1
  231. package/src/concepts/relations/components/__tests__/ConceptSelector2.spec.js +0 -76
  232. package/src/concepts/selectors/__tests__/getConceptSubscope.spec.js +0 -37
  233. package/src/concepts/selectors/__tests__/getSidemenuGlossarySubscopes.spec.js +0 -17
  234. package/src/concepts/selectors/getConceptStatus.js +0 -1
  235. package/src/concepts/selectors/getConceptSubscope.js +0 -19
  236. package/src/concepts/selectors/getSidemenuGlossarySubscopes.js +0 -8
@@ -1,32 +1,36 @@
1
- import React from "react";
2
- import { shallow, mount } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { ConceptSubscriptionLoader } from "../ConceptSubscriptionLoader";
4
3
 
5
- jest.mock("react-router-dom", () => ({
6
- ...jest.requireActual("react-router-dom"),
7
- useParams: () => ({ id: 1 })
4
+ jest.mock("react-router", () => ({
5
+ ...jest.requireActual("react-router"),
6
+ useParams: () => ({ id: 1 }),
8
7
  }));
9
8
 
10
9
  describe("<ConceptSubscriptionLoader />", () => {
11
10
  const searchSubscriptions = jest.fn();
12
11
  const clearSubscriptionsSearch = jest.fn();
13
12
 
14
- it("matches the latest snapshot", () => {
15
- const props = { clearSubscriptionsSearch, searchSubscriptions };
16
- const wrapper = shallow(<ConceptSubscriptionLoader {...props} />);
17
- expect(wrapper).toMatchSnapshot();
13
+ const props = { clearSubscriptionsSearch, searchSubscriptions };
14
+
15
+ it("matches the latest snapshot", async () => {
16
+ const rendered = render(<ConceptSubscriptionLoader {...props} />);
17
+ await waitForLoad(rendered);
18
+ expect(rendered.container).toMatchSnapshot();
18
19
  });
19
20
 
20
- it("calls searchSubscriptions when component mounts, clearSubscriptionsSearch when component unmounts", () => {
21
+ it("calls searchSubscriptions when component mounts, clearSubscriptionsSearch when component unmounts", async () => {
21
22
  const searchSubscriptions = jest.fn();
22
23
  const clearSubscriptionsSearch = jest.fn();
23
24
 
24
25
  const props = { searchSubscriptions, clearSubscriptionsSearch };
25
- const wrapper = mount(<ConceptSubscriptionLoader {...props} />);
26
- expect(clearSubscriptionsSearch.mock.calls.length).toBe(0);
27
- expect(searchSubscriptions.mock.calls.length).toBe(1);
28
- wrapper.unmount();
29
- expect(clearSubscriptionsSearch.mock.calls.length).toBe(1);
30
- expect(searchSubscriptions.mock.calls.length).toBe(1);
26
+ const rendered = render(<ConceptSubscriptionLoader {...props} />);
27
+ await waitForLoad(rendered);
28
+
29
+ expect(clearSubscriptionsSearch).not.toHaveBeenCalled();
30
+ expect(searchSubscriptions).toHaveBeenCalledTimes(1);
31
+
32
+ rendered.unmount();
33
+ expect(clearSubscriptionsSearch).toHaveBeenCalledTimes(1);
34
+ expect(searchSubscriptions).toHaveBeenCalledTimes(1);
31
35
  });
32
36
  });
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { ConceptSummary } from "../ConceptSummary";
4
3
 
5
4
  const concept = {
@@ -17,21 +16,23 @@ const concept = {
17
16
  const props = { concept };
18
17
 
19
18
  describe("<ConceptSummary />", () => {
20
- it("matches the latest snapshot", () => {
21
- const { container } = render(<ConceptSummary {...props} />);
22
- expect(container).toMatchSnapshot();
19
+ it("matches the latest snapshot", async () => {
20
+ const rendered = render(<ConceptSummary {...props} />);
21
+ await waitForLoad(rendered);
22
+ expect(rendered.container).toMatchSnapshot();
23
23
  });
24
24
 
25
- it("show correct change and user for versioned", () => {
25
+ it("show correct change and user for versioned", async () => {
26
26
  const newProps = {
27
27
  concept: {
28
28
  ...concept,
29
29
  status: "versioned",
30
30
  },
31
31
  };
32
- const { queryByText } = render(<ConceptSummary {...newProps} />);
33
- expect(queryByText(/Versioned/)).toBeInTheDocument();
34
- expect(queryByText(/foo/)).toBeInTheDocument();
35
- expect(queryByText(/2024-01-01/)).toBeInTheDocument();
32
+ const rendered = render(<ConceptSummary {...newProps} />);
33
+ await waitForLoad(rendered);
34
+ expect(rendered.getByText(/versioned/i)).toBeInTheDocument();
35
+ expect(rendered.getByText(/foo/i)).toBeInTheDocument();
36
+ expect(rendered.getByText(/2024-01-01/i)).toBeInTheDocument();
36
37
  });
37
38
  });
@@ -1,10 +1,78 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { ConceptTabPane } from "../ConceptTabPane";
2
+ import { render, waitForLoad } from "@truedat/test/render";
3
+ import ConceptTabPane from "../ConceptTabPane";
4
+ import {
5
+ CONCEPT_VERSION,
6
+ CONCEPT_ARCHIVE,
7
+ CONCEPT_EVENTS,
8
+ CONCEPT_RULES,
9
+ CONCEPT_RULES_NEW,
10
+ } from "@truedat/core/routes";
11
+
12
+ // Mock child components
13
+ jest.mock("../ConceptDetails", () => () => <div>ConceptDetails</div>);
14
+ jest.mock("../ConceptArchive", () => () => <div>ConceptArchive</div>);
15
+ jest.mock("../Events", () => () => <div>Events</div>);
16
+ jest.mock("../../relations/components/ConceptRelationsRoutes", () => () => (
17
+ <div>ConceptRelationsRoutes</div>
18
+ ));
19
+ jest.mock("@truedat/dq/components/ConceptRules", () => () => (
20
+ <div>ConceptRules</div>
21
+ ));
22
+ jest.mock("@truedat/dq/components/NewRule", () => () => <div>NewRule</div>);
4
23
 
5
24
  describe("<ConceptTabPane />", () => {
6
- it("matches the latest snapshot", () => {
7
- const wrapper = shallow(<ConceptTabPane />);
8
- expect(wrapper).toMatchSnapshot();
25
+ it("renders correctly with default route", async () => {
26
+ const rendered = render(<ConceptTabPane />);
27
+ await waitForLoad(rendered);
28
+ expect(rendered.container).toMatchSnapshot();
29
+ });
30
+
31
+ it("renders correctly with concept version route", async () => {
32
+ const rendered = render(<ConceptTabPane />, {
33
+ routes: [CONCEPT_VERSION],
34
+ });
35
+ await waitForLoad(rendered);
36
+ expect(rendered.container).toMatchSnapshot();
37
+ });
38
+
39
+ it("renders correctly with archive route", async () => {
40
+ const rendered = render(<ConceptTabPane />, {
41
+ routes: [CONCEPT_ARCHIVE],
42
+ });
43
+ await waitForLoad(rendered);
44
+ expect(rendered.container).toMatchSnapshot();
45
+ });
46
+
47
+ it("renders correctly with events route", async () => {
48
+ const rendered = render(<ConceptTabPane />, {
49
+ routes: [CONCEPT_EVENTS],
50
+ });
51
+ await waitForLoad(rendered);
52
+ expect(rendered.container).toMatchSnapshot();
53
+ });
54
+
55
+ it("renders correctly with links route", async () => {
56
+ const rendered = render(<ConceptTabPane />, {
57
+ routes: [`${CONCEPT_VERSION}/links`],
58
+ });
59
+ await waitForLoad(rendered);
60
+ expect(rendered.container).toMatchSnapshot();
61
+ });
62
+
63
+ it("renders correctly with rules route", async () => {
64
+ const rendered = render(<ConceptTabPane />, {
65
+ routes: [CONCEPT_RULES],
66
+ });
67
+ await waitForLoad(rendered);
68
+ expect(rendered.container).toMatchSnapshot();
69
+ });
70
+
71
+ it("renders correctly with new rule route", async () => {
72
+ const rendered = render(<ConceptTabPane />, {
73
+ routes: [CONCEPT_RULES_NEW],
74
+ });
75
+ await waitForLoad(rendered);
76
+ expect(rendered.container).toMatchSnapshot();
9
77
  });
10
78
  });
@@ -1,40 +1,25 @@
1
- import React from "react";
2
1
  import { render } from "@truedat/test/render";
3
2
  import { ConceptTabs } from "../ConceptTabs";
4
3
 
5
4
  describe("<ConceptTabs />", () => {
6
- const renderOpts = {
7
- messages: {
8
- en: {
9
- "tabs.bg.concept": "concept",
10
- "tabs.bg.relations_data_field": "relations_data_field",
11
- "tabs.bg.relations_business_concept": "relations_business_concept",
12
- "tabs.bg.qualityRules": "qualityRules",
13
- "tabs.bg.qualityImplementations": "qualityImplementations",
14
- "tabs.bg.history": "history",
15
- "tabs.bg.audit": "audit",
16
- },
17
- },
18
- };
19
-
20
5
  const props = {
21
6
  concept: {
22
- id: 1,
23
- business_concept_id: 8,
7
+ id: "1",
8
+ business_concept_id: "8",
24
9
  },
25
10
  emptyConceptTags: false,
26
11
  emptyImplementationLinks: false,
27
12
  };
28
13
  it("matches the latest snapshot", () => {
29
- const { container } = render(<ConceptTabs {...props} />, renderOpts);
14
+ const { container } = render(<ConceptTabs {...props} />);
30
15
  expect(container).toMatchSnapshot();
31
16
  });
32
17
 
33
18
  it("With concept tags and implementation links", () => {
34
19
  const props = {
35
20
  concept: {
36
- id: 1,
37
- business_concept_id: 8,
21
+ id: "1",
22
+ business_concept_id: "8",
38
23
  },
39
24
  emptyConceptTags: true,
40
25
  emptyImplementationLinks: true,
@@ -42,7 +27,7 @@ describe("<ConceptTabs />", () => {
42
27
  createLinkImplementation: { method: "POST" },
43
28
  createImplementation: { method: "POST" },
44
29
  };
45
- const { container } = render(<ConceptTabs {...props} />, renderOpts);
30
+ const { container } = render(<ConceptTabs {...props} />);
46
31
  expect(container).toMatchSnapshot();
47
32
  });
48
33
  });
@@ -1,28 +1,32 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { ConceptTaxonomy } from "../ConceptTaxonomy";
4
3
 
5
4
  describe("<ConceptTaxonomy />", () => {
6
5
  const domainPath = [
7
6
  { id: 0, name: "name0", external_id: "eid0" },
8
7
  { id: 1, name: "name1", external_id: "eid1" },
9
- { id: 2, name: "name2", external_id: "eid2" }
8
+ { id: 2, name: "name2", external_id: "eid2" },
10
9
  ];
11
- it("matches the latest snapshot", () => {
10
+
11
+ it("matches the latest snapshot", async () => {
12
12
  const props = { domainPath };
13
- const wrapper = shallow(<ConceptTaxonomy {...props} />);
14
- expect(wrapper).toMatchSnapshot();
13
+ const rendered = render(<ConceptTaxonomy {...props} />);
14
+ await waitForLoad(rendered);
15
+ expect(rendered.container).toMatchSnapshot();
15
16
  });
16
17
 
17
- it("doest not render component when not domainPath provided", () => {
18
+ it("does not render component when no domainPath provided", async () => {
18
19
  const props = { domainPath: [] };
19
- const wrapper = shallow(<ConceptTaxonomy {...props} />);
20
- expect(wrapper.find("Segment").exists()).toBeFalsy();
20
+ const rendered = render(<ConceptTaxonomy {...props} />);
21
+ await waitForLoad(rendered);
22
+ expect(rendered.container.querySelector("Segment")).not.toBeInTheDocument();
21
23
  });
22
24
 
23
- it("renders as many items as domains", () => {
25
+ it("renders as many items as domains", async () => {
24
26
  const props = { domainPath };
25
- const wrapper = shallow(<ConceptTaxonomy {...props} />);
26
- expect(wrapper.find("DomainItem").length).toBe(3);
27
+ const rendered = render(<ConceptTaxonomy {...props} />);
28
+ await waitForLoad(rendered);
29
+
30
+ expect(rendered.container.querySelectorAll(".highlighted").length).toBe(3);
27
31
  });
28
32
  });
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { waitFor } from "@testing-library/react";
4
3
  import { Concepts } from "../Concepts";
5
4
  import { defaultConceptColumns } from "../../selectors";
@@ -45,20 +44,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
45
44
  }),
46
45
  };
47
46
  });
48
-
49
- const messages = {
50
- en: {
51
- "search.placeholder": "Search concepts...",
52
- "concepts.searching": "Searching...",
53
- "concepts.search.results.empty": "No concepts found",
54
- "concepts.retrieved.results": "{count} concepts found",
55
- "concepts.props.last_change_at": "Last modification date",
56
- "concepts.props.link_count": "Link to field",
57
- "concepts.props.rule_count": "Quality rules",
58
- "concepts.props.domain": "Domain",
59
- "concepts.props.name": "Term",
60
- },
61
- };
47
+ jest.mock("@truedat/core/hooks/useUserFilters");
62
48
 
63
49
  const state = {
64
50
  conceptsColumns: {
@@ -69,7 +55,6 @@ const state = {
69
55
  describe("<Concepts />", () => {
70
56
  it("matches the latest snapshot", async () => {
71
57
  const renderOpts = {
72
- messages,
73
58
  state,
74
59
  };
75
60
 
@@ -87,15 +72,10 @@ describe("<Concepts />", () => {
87
72
  update,
88
73
  create,
89
74
  };
90
- const { container, findByText } = render(
91
- <Concepts {...props} />,
92
- renderOpts
93
- );
94
- await waitFor(() => {
95
- expect(container.querySelector(".loading")).toBeNull();
96
- });
75
+ const rendered = render(<Concepts {...props} />, renderOpts);
76
+ await waitForLoad(rendered);
97
77
 
98
- await findByText(/7/);
99
- expect(container).toMatchSnapshot();
78
+ await rendered.findByText(/7/i);
79
+ expect(rendered.container).toMatchSnapshot();
100
80
  });
101
81
  });
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { render } from "@truedat/test/render";
3
2
  import { SearchContextProvider } from "@truedat/core/search/SearchContext";
4
3
  import { ConceptsActions } from "../ConceptsActions";
@@ -1,13 +1,12 @@
1
- import React from "react";
2
- import { waitFor } from "@testing-library/react";
3
1
  import userEvent from "@testing-library/user-event";
4
- import { render } from "@truedat/test/render";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { render, waitForLoad } from "@truedat/test/render";
5
4
  import { domainsMock, templateByNameMock } from "@truedat/test/mocks";
6
5
  import { bulkUpdate } from "../../routines";
7
6
  import ConceptsBulkUpdate from "../ConceptsBulkUpdate";
8
7
 
9
- jest.mock("react-router-dom", () => ({
10
- ...jest.requireActual("react-router-dom"),
8
+ jest.mock("react-router", () => ({
9
+ ...jest.requireActual("react-router"),
11
10
  useLocation: () => ({ search: "?concepts" }),
12
11
  }));
13
12
 
@@ -38,51 +37,47 @@ const renderOpts = {
38
37
  templateByNameMock({ name: "template1", domainIds: [1] }),
39
38
  ],
40
39
  state,
41
- fallback: "lazy",
42
40
  };
43
41
 
44
42
  describe("<ConceptsBulkUpdate />", () => {
45
43
  it("matches the latest snapshot", async () => {
46
- const { container, queryByText } = render(
47
- <ConceptsBulkUpdate />,
48
- renderOpts
49
- );
50
-
51
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
52
- await waitFor(() =>
53
- expect(queryByText(/loading/i)).not.toBeInTheDocument()
54
- );
55
-
56
- expect(container).toMatchSnapshot();
44
+ const rendered = render(<ConceptsBulkUpdate />, renderOpts);
45
+ await waitForLoad(rendered);
46
+ expect(rendered.container).toMatchSnapshot();
57
47
  });
58
48
 
59
49
  it("DynamicForm rendered if template, template_id, selectedDomain informed", async () => {
50
+ const user = userEvent.setup({ delay: null });
60
51
  const props = { applyTemplate: jest.fn() };
61
- const { findByText, queryByText } = render(
62
- <ConceptsBulkUpdate {...props} />,
63
- renderOpts
52
+ const rendered = render(<ConceptsBulkUpdate {...props} />, renderOpts);
53
+ await waitForLoad(rendered);
54
+
55
+ await user.click(rendered.getByText(/foodomain/i));
56
+ await waitFor(() =>
57
+ expect(rendered.queryByText(/field1/i)).toBeInTheDocument()
64
58
  );
65
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
66
- userEvent.click(await findByText("fooDomain"));
67
- await waitFor(() => expect(queryByText(/field1/)).toBeInTheDocument());
68
59
  });
69
60
 
70
61
  it("calls bulkUpdate on onClick", async () => {
62
+ const user = userEvent.setup({ delay: null });
71
63
  const dispatch = jest.fn();
72
- const { findByText, queryByText, findByPlaceholderText } = render(
73
- <ConceptsBulkUpdate />,
74
- {
75
- ...renderOpts,
76
- dispatch,
77
- }
64
+ const rendered = render(<ConceptsBulkUpdate />, {
65
+ ...renderOpts,
66
+ dispatch,
67
+ });
68
+ await waitForLoad(rendered);
69
+
70
+ await user.click(rendered.getByText(/foodomain/i));
71
+ await waitFor(() =>
72
+ expect(rendered.queryByText(/field1/i)).toBeInTheDocument()
78
73
  );
79
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
80
- userEvent.click(await findByText("fooDomain"));
81
- await waitFor(() => expect(queryByText(/field1/)).toBeInTheDocument());
82
- userEvent.type(await findByPlaceholderText("field1"), "abc123456");
83
- await waitFor(() => expect(queryByText(/Save/)).toBeEnabled());
84
- userEvent.click(await findByText("Save"));
85
- userEvent.click(await findByText("Yes"));
74
+
75
+ await user.type(rendered.getByPlaceholderText(/field1/i), "abc123456");
76
+ await waitFor(() => expect(rendered.queryByText(/save/i)).toBeEnabled());
77
+
78
+ await user.click(rendered.getByText(/save/i));
79
+ await user.click(rendered.getByText(/yes/i));
80
+
86
81
  await waitFor(() => {
87
82
  expect(dispatch).toHaveBeenLastCalledWith(
88
83
  bulkUpdate({
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { SearchContextProvider } from "@truedat/core/search/SearchContext";
4
3
  import ConceptsLabelResults from "../ConceptsLabelResults";
5
4
 
@@ -32,12 +31,12 @@ const searchProps = {
32
31
 
33
32
  describe("<ConceptsLabelResults />", () => {
34
33
  it("matches the latest snapshot", async () => {
35
- const { container, findByText } = render(
34
+ const rendered = render(
36
35
  <SearchContextProvider {...searchProps} defaultFilters={defaultFilters}>
37
36
  <ConceptsLabelResults />
38
37
  </SearchContextProvider>
39
38
  );
40
- await findByText(/22 concepts found/);
41
- expect(container).toMatchSnapshot();
39
+ await waitForLoad(rendered);
40
+ expect(rendered.container).toMatchSnapshot();
42
41
  });
43
42
  });
@@ -1,12 +1,11 @@
1
- import React from "react";
2
1
  import { render } from "@truedat/test/render";
3
2
  import { ConceptsLinkDecorator } from "../ConceptsLinkDecorator";
4
3
 
5
4
  describe("<ConceptsLinkDecorator />", () => {
6
5
  const concepts = [
7
- { id: 1, name: "concept1" },
8
- { id: 2, name: "concept2" },
9
- { id: 3, name: "concept3" },
6
+ { id: "1", name: "concept1" },
7
+ { id: "2", name: "concept2" },
8
+ { id: "3", name: "concept3" },
10
9
  ];
11
10
  it("matches the latest snapshot", () => {
12
11
  const { container } = render(<>{ConceptsLinkDecorator(concepts)}</>);
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { waitFor } from "@testing-library/react";
4
3
  import ConceptsPanel from "../ConceptsPanel";
5
4
  import { defaultConceptColumns } from "../../selectors";
@@ -44,20 +43,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
44
43
  }),
45
44
  };
46
45
  });
47
-
48
- const messages = {
49
- en: {
50
- "search.placeholder": "Search concepts...",
51
- "concepts.searching": "Searching...",
52
- "concepts.search.results.empty": "No concepts found",
53
- "concepts.retrieved.results": "{count} concepts found",
54
- "concepts.props.last_change_at": "Last modification date",
55
- "concepts.props.link_count": "Link to field",
56
- "concepts.props.rule_count": "Quality rules",
57
- "concepts.props.domain": "Domain",
58
- "concepts.props.name": "Term",
59
- },
60
- };
46
+ jest.mock("@truedat/core/hooks/useUserFilters");
61
47
 
62
48
  const state = {
63
49
  conceptsColumns: {
@@ -66,7 +52,6 @@ const state = {
66
52
  };
67
53
 
68
54
  const renderOpts = {
69
- messages,
70
55
  state,
71
56
  };
72
57
 
@@ -75,14 +60,10 @@ describe("<ConceptsPanel />", () => {
75
60
  defaultFilters: {},
76
61
  };
77
62
  it("matches latest snapshot", async () => {
78
- const { container, findByText } = render(
79
- <ConceptsPanel {...props} />,
80
- renderOpts
81
- );
82
- await waitFor(() => {
83
- expect(container.querySelector(".loading")).toBeNull();
84
- });
85
- await findByText(/7/);
86
- expect(container).toMatchSnapshot();
63
+ const rendered = render(<ConceptsPanel {...props} />, renderOpts);
64
+ await waitForLoad(rendered);
65
+
66
+ await rendered.findByText(/7/i);
67
+ expect(rendered.container).toMatchSnapshot();
87
68
  });
88
69
  });