@truedat/bg 7.5.9 → 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.
- package/package.json +41 -70
- package/src/concepts/components/Concept.js +22 -19
- package/src/concepts/components/ConceptActions.js +1 -2
- package/src/concepts/components/ConceptArchive.js +0 -1
- package/src/concepts/components/ConceptArchiveRow.js +3 -4
- package/src/concepts/components/ConceptCompleteness.js +1 -2
- package/src/concepts/components/ConceptConfidentialButton.js +1 -2
- package/src/concepts/components/ConceptCreate.js +1 -1
- package/src/concepts/components/ConceptCrumbs.js +10 -8
- package/src/concepts/components/ConceptDeleteModalBody.js +7 -10
- package/src/concepts/components/ConceptDetails.js +3 -3
- package/src/concepts/components/ConceptEdit.js +2 -2
- package/src/concepts/components/ConceptForm.js +39 -43
- package/src/concepts/components/ConceptHeader.js +0 -1
- package/src/concepts/components/ConceptLinksDropdownSelector.js +1 -2
- package/src/concepts/components/ConceptLoader.js +3 -3
- package/src/concepts/components/ConceptManageDomain.js +2 -1
- package/src/concepts/components/ConceptManageDomainPopup.js +1 -1
- package/src/concepts/components/ConceptRoutes.js +263 -226
- package/src/concepts/components/ConceptRow.js +0 -1
- package/src/concepts/components/ConceptSubscription.js +15 -14
- package/src/concepts/components/ConceptSummary.js +0 -1
- package/src/concepts/components/ConceptTabPane.js +36 -41
- package/src/concepts/components/ConceptTabs.js +1 -4
- package/src/concepts/components/ConceptTaxonomy.js +1 -3
- package/src/concepts/components/Concepts.js +0 -1
- package/src/concepts/components/ConceptsActions.js +2 -3
- package/src/concepts/components/ConceptsBulkUpdate.js +3 -6
- package/src/concepts/components/ConceptsLabelResults.js +0 -1
- package/src/concepts/components/ConceptsLinkDecorator.js +1 -2
- package/src/concepts/components/ConceptsLinksManagement.js +7 -8
- package/src/concepts/components/ConceptsPagination.js +0 -1
- package/src/concepts/components/ConceptsPanel.js +5 -4
- package/src/concepts/components/ConceptsTable.js +2 -3
- package/src/concepts/components/ConceptsUpdateButton.js +6 -6
- package/src/concepts/components/ConceptsUploadButton.js +0 -1
- package/src/concepts/components/ConceptsUploadEvents.js +0 -2
- package/src/concepts/components/ConceptsUploadEventsTable.js +12 -19
- package/src/concepts/components/DomainConcepts.js +0 -1
- package/src/concepts/components/EventRow.js +0 -1
- package/src/concepts/components/Events.js +3 -4
- package/src/concepts/components/FieldGroupTable.js +1 -2
- package/src/concepts/components/LinkedMessage.js +9 -13
- package/src/concepts/components/SharedToDomains.js +8 -7
- package/src/concepts/components/SharedToDomainsPopup.js +1 -1
- package/src/concepts/components/SharedToForm.js +3 -6
- package/src/concepts/components/__tests__/Concept.spec.js +8 -42
- package/src/concepts/components/__tests__/ConceptActions.spec.js +7 -7
- package/src/concepts/components/__tests__/ConceptArchive.spec.js +5 -5
- package/src/concepts/components/__tests__/ConceptArchiveLoader.spec.js +15 -14
- package/src/concepts/components/__tests__/ConceptArchiveRow.spec.js +0 -1
- package/src/concepts/components/__tests__/ConceptCompleteness.spec.js +0 -1
- package/src/concepts/components/__tests__/ConceptConfidentialButton.spec.js +10 -17
- package/src/concepts/components/__tests__/ConceptContext.spec.js +1 -1
- package/src/concepts/components/__tests__/ConceptCrumbs.spec.js +12 -34
- package/src/concepts/components/__tests__/ConceptDeleteModalBody.spec.js +47 -26
- package/src/concepts/components/__tests__/ConceptDetails.spec.js +1 -9
- package/src/concepts/components/__tests__/ConceptEdit.spec.js +2 -2
- package/src/concepts/components/__tests__/ConceptForm.spec.js +26 -19
- package/src/concepts/components/__tests__/ConceptHeader.spec.js +33 -57
- package/src/concepts/components/__tests__/ConceptLinksManagement.spec.js +27 -34
- package/src/concepts/components/__tests__/ConceptLoader.spec.js +51 -37
- package/src/concepts/components/__tests__/ConceptManageDomain.spec.js +12 -47
- package/src/concepts/components/__tests__/ConceptManageDomainPopup.spec.js +65 -24
- package/src/concepts/components/__tests__/ConceptRow.spec.js +6 -17
- package/src/concepts/components/__tests__/ConceptSubscription.spec.js +9 -9
- package/src/concepts/components/__tests__/ConceptSubscriptionLoader.spec.js +20 -16
- package/src/concepts/components/__tests__/ConceptSummary.spec.js +11 -10
- package/src/concepts/components/__tests__/ConceptTabPane.spec.js +73 -5
- package/src/concepts/components/__tests__/ConceptTabs.spec.js +6 -21
- package/src/concepts/components/__tests__/ConceptTaxonomy.spec.js +16 -12
- package/src/concepts/components/__tests__/Concepts.spec.js +6 -26
- package/src/concepts/components/__tests__/ConceptsActions.spec.js +0 -1
- package/src/concepts/components/__tests__/ConceptsBulkUpdate.spec.js +31 -36
- package/src/concepts/components/__tests__/ConceptsLabelResults.spec.js +4 -5
- package/src/concepts/components/__tests__/ConceptsLinkDecorator.spec.js +3 -4
- package/src/concepts/components/__tests__/ConceptsPanel.spec.js +7 -26
- package/src/concepts/components/__tests__/ConceptsTable.spec.js +34 -60
- package/src/concepts/components/__tests__/ConceptsUpdateButton.spec.js +6 -7
- package/src/concepts/components/__tests__/ConceptsUploadButton.spec.js +25 -13
- package/src/concepts/components/__tests__/ConceptsUploadEventsTable.spec.js +11 -9
- package/src/concepts/components/__tests__/Events.spec.js +10 -10
- package/src/concepts/components/__tests__/SharedToDomains.spec.js +25 -19
- package/src/concepts/components/__tests__/SharedToDomainsPopup.spec.js +48 -36
- package/src/concepts/components/__tests__/SharedToForm.spec.js +24 -32
- package/src/concepts/components/__tests__/__snapshots__/Concept.spec.js.snap +108 -23
- package/src/concepts/components/__tests__/__snapshots__/ConceptActions.spec.js.snap +12 -16
- package/src/concepts/components/__tests__/__snapshots__/ConceptArchive.spec.js.snap +77 -65
- package/src/concepts/components/__tests__/__snapshots__/ConceptArchiveRow.spec.js.snap +2 -4
- package/src/concepts/components/__tests__/__snapshots__/ConceptConfidentialButton.spec.js.snap +11 -31
- package/src/concepts/components/__tests__/__snapshots__/ConceptCrumbs.spec.js.snap +41 -56
- package/src/concepts/components/__tests__/__snapshots__/ConceptDeleteModalBody.spec.js.snap +3 -5
- package/src/concepts/components/__tests__/__snapshots__/ConceptDetails.spec.js.snap +0 -1
- package/src/concepts/components/__tests__/__snapshots__/ConceptEdit.spec.js.snap +1 -12
- package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +10 -11
- package/src/concepts/components/__tests__/__snapshots__/ConceptHeader.spec.js.snap +2 -2
- package/src/concepts/components/__tests__/__snapshots__/ConceptLinksManagement.spec.js.snap +14 -14
- package/src/concepts/components/__tests__/__snapshots__/ConceptLoader.spec.js.snap +14 -9
- package/src/concepts/components/__tests__/__snapshots__/ConceptManageDomain.spec.js.snap +43 -5
- package/src/concepts/components/__tests__/__snapshots__/ConceptManageDomainPopup.spec.js.snap +10 -163
- package/src/concepts/components/__tests__/__snapshots__/ConceptRow.spec.js.snap +4 -7
- package/src/concepts/components/__tests__/__snapshots__/ConceptSubscription.spec.js.snap +8 -55
- package/src/concepts/components/__tests__/__snapshots__/ConceptSubscriptionLoader.spec.js.snap +1 -1
- package/src/concepts/components/__tests__/__snapshots__/ConceptSummary.spec.js.snap +6 -6
- package/src/concepts/components/__tests__/__snapshots__/ConceptTabPane.spec.js.snap +18 -34
- package/src/concepts/components/__tests__/__snapshots__/ConceptTabs.spec.js.snap +26 -13
- package/src/concepts/components/__tests__/__snapshots__/ConceptTaxonomy.spec.js.snap +63 -53
- package/src/concepts/components/__tests__/__snapshots__/Concepts.spec.js.snap +10 -25
- package/src/concepts/components/__tests__/__snapshots__/ConceptsActions.spec.js.snap +1 -0
- package/src/concepts/components/__tests__/__snapshots__/ConceptsBulkUpdate.spec.js.snap +7 -6
- package/src/concepts/components/__tests__/__snapshots__/ConceptsLabelResults.spec.js.snap +1 -1
- package/src/concepts/components/__tests__/__snapshots__/ConceptsLinkDecorator.spec.js.snap +1 -0
- package/src/concepts/components/__tests__/__snapshots__/ConceptsPanel.spec.js.snap +10 -25
- package/src/concepts/components/__tests__/__snapshots__/ConceptsTable.spec.js.snap +1 -1
- package/src/concepts/components/__tests__/__snapshots__/ConceptsUpdateButton.spec.js.snap +1 -1
- package/src/concepts/components/__tests__/__snapshots__/ConceptsUploadButton.spec.js.snap +9 -74
- package/src/concepts/components/__tests__/__snapshots__/ConceptsUploadEventsTable.spec.js.snap +14 -14
- package/src/concepts/components/__tests__/__snapshots__/Events.spec.js.snap +83 -43
- package/src/concepts/components/__tests__/__snapshots__/SharedToDomains.spec.js.snap +56 -33
- package/src/concepts/components/__tests__/__snapshots__/SharedToDomainsPopup.spec.js.snap +9 -145
- package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +2 -2
- package/src/concepts/reducers/__tests__/conceptRedirect.spec.js +1 -1
- package/src/concepts/reducers/conceptRedirect.js +5 -5
- package/src/concepts/relations/components/ConceptImplementationLinks.js +5 -4
- package/src/concepts/relations/components/ConceptLinkActions.js +1 -1
- package/src/concepts/relations/components/ConceptLinksActions.js +4 -4
- package/src/concepts/relations/components/ConceptRelationActions.js +3 -4
- package/src/concepts/relations/components/ConceptRelationForm.js +3 -3
- package/src/concepts/relations/components/ConceptRelationRow.js +10 -10
- package/src/concepts/relations/components/ConceptRelations.js +9 -11
- package/src/concepts/relations/components/ConceptRelationsRoutes.js +20 -39
- package/src/concepts/relations/components/ConceptRelationsSummary.js +26 -29
- package/src/concepts/relations/components/ConceptSelector.js +4 -7
- package/src/concepts/relations/components/ConceptStructureLinks.js +2 -2
- package/src/concepts/relations/components/__tests__/ConceptImplementationLinks.spec.js +19 -59
- package/src/concepts/relations/components/__tests__/ConceptLinksActions.spec.js +9 -10
- package/src/concepts/relations/components/__tests__/ConceptRelationActions.spec.js +9 -7
- package/src/concepts/relations/components/__tests__/ConceptRelationForm.spec.js +30 -42
- package/src/concepts/relations/components/__tests__/ConceptRelationRow.spec.js +11 -16
- package/src/concepts/relations/components/__tests__/ConceptRelations.spec.js +11 -14
- package/src/concepts/relations/components/__tests__/ConceptRelationsRoutes.spec.js +108 -8
- package/src/concepts/relations/components/__tests__/ConceptRelationsSummary.spec.js +39 -38
- package/src/concepts/relations/components/__tests__/ConceptSelector.spec.js +24 -36
- package/src/concepts/relations/components/__tests__/ConceptStructureLinks.spec.js +21 -11
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptImplementationLinks.spec.js.snap +131 -28
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptLinksActions.spec.js.snap +4 -3
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationActions.spec.js.snap +10 -26
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationForm.spec.js.snap +15 -19
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationRow.spec.js.snap +36 -33
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelations.spec.js.snap +76 -51
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationsRoutes.spec.js.snap +15 -29
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationsSummary.spec.js.snap +45 -100
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptSelector.spec.js.snap +9 -9
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptStructureLinks.spec.js.snap +10 -10
- package/src/concepts/relations/sagas/conceptLinkAction.js +2 -2
- package/src/concepts/relations/sagas/linkConcept.js +1 -1
- package/src/concepts/relations/selectors/getBusinessConceptsLinksToImplementationsColumns.js +1 -2
- package/src/concepts/relations/selectors/getConceptLinks.js +1 -2
- package/src/concepts/relations/selectors/getConceptRelations.js +14 -14
- package/src/concepts/sagas/__tests__/saveSharedTo.spec.js +3 -3
- package/src/concepts/sagas/__tests__/setConfidentialConcept.spec.js +5 -5
- package/src/concepts/sagas/conceptAction.js +2 -2
- package/src/concepts/sagas/fetchConceptArchive.js +1 -1
- package/src/concepts/sagas/setConfidentialConcept.js +2 -2
- package/src/concepts/selectors/__tests__/getConceptDomainPath.spec.js +2 -2
- package/src/concepts/selectors/getConceptColumns.js +1 -2
- package/src/concepts/selectors/getConceptTemplate.js +1 -1
- package/src/concepts/selectors/getConceptUploadEventColumns.js +0 -1
- package/src/concepts/selectors/getConceptVersionPath.js +2 -2
- package/src/concepts/selectors/getParsedEvents.js +2 -2
- package/src/concepts/selectors/getTemplateFields.js +3 -3
- package/src/concepts/selectors/getTemplateGroups.js +1 -1
- package/src/hooks/__mocks__/useDomains.js +42 -0
- package/src/hooks/useDomains.js +3 -3
- package/src/taxonomy/components/AddDomainMember.js +3 -4
- package/src/taxonomy/components/Domain.js +19 -23
- package/src/taxonomy/components/DomainActions.js +1 -2
- package/src/taxonomy/components/DomainCards.js +4 -6
- package/src/taxonomy/components/DomainContent.js +42 -87
- package/src/taxonomy/components/DomainCrumbs.js +4 -4
- package/src/taxonomy/components/DomainDetail.js +4 -5
- package/src/taxonomy/components/DomainForm.js +1 -3
- package/src/taxonomy/components/DomainImplementations.js +8 -7
- package/src/taxonomy/components/DomainItem.js +1 -2
- package/src/taxonomy/components/DomainMembers.js +0 -1
- package/src/taxonomy/components/DomainRoutes.js +15 -21
- package/src/taxonomy/components/DomainSearch.js +0 -1
- package/src/taxonomy/components/DomainStructures.js +0 -1
- package/src/taxonomy/components/DomainTabs.js +3 -4
- package/src/taxonomy/components/DomainTaxonomy.js +1 -2
- package/src/taxonomy/components/Domains.js +15 -5
- package/src/taxonomy/components/DomainsActions.js +2 -4
- package/src/taxonomy/components/EditDomain.js +5 -5
- package/src/taxonomy/components/NewDomain.js +4 -4
- package/src/taxonomy/components/__tests__/AddDomainMember.spec.js +6 -5
- package/src/taxonomy/components/__tests__/Domain.spec.js +63 -123
- package/src/taxonomy/components/__tests__/DomainActions.spec.js +0 -1
- package/src/taxonomy/components/__tests__/DomainCards.spec.js +44 -51
- package/src/taxonomy/components/__tests__/DomainContent.spec.js +138 -158
- package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +14 -19
- package/src/taxonomy/components/__tests__/DomainDetail.spec.js +2 -3
- package/src/taxonomy/components/__tests__/DomainForm.spec.js +44 -60
- package/src/taxonomy/components/__tests__/DomainItem.spec.js +17 -14
- package/src/taxonomy/components/__tests__/DomainMembers.spec.js +9 -13
- package/src/taxonomy/components/__tests__/DomainRoutes.spec.js +54 -0
- package/src/taxonomy/components/__tests__/DomainStructures.spec.js +10 -51
- package/src/taxonomy/components/__tests__/DomainTabs.spec.js +14 -33
- package/src/taxonomy/components/__tests__/DomainTaxonomy.spec.js +17 -16
- package/src/taxonomy/components/__tests__/Domains.spec.js +63 -95
- package/src/taxonomy/components/__tests__/DomainsActions.spec.js +12 -11
- package/src/taxonomy/components/__tests__/EditDomain.spec.js +13 -54
- package/src/taxonomy/components/__tests__/NewDomain.spec.js +17 -61
- package/src/taxonomy/components/__tests__/__snapshots__/AddDomainMember.spec.js.snap +10 -9
- package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +53 -72
- package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +2 -1
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCards.spec.js.snap +247 -27
- package/src/taxonomy/components/__tests__/__snapshots__/DomainContent.spec.js.snap +14 -294
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +6 -2
- package/src/taxonomy/components/__tests__/__snapshots__/DomainDetail.spec.js.snap +5 -4
- package/src/taxonomy/components/__tests__/__snapshots__/DomainForm.spec.js.snap +13 -12
- package/src/taxonomy/components/__tests__/__snapshots__/DomainItem.spec.js.snap +16 -12
- package/src/taxonomy/components/__tests__/__snapshots__/DomainRoutes.spec.js.snap +52 -0
- package/src/taxonomy/components/__tests__/__snapshots__/DomainStructures.spec.js.snap +7 -7
- package/src/taxonomy/components/__tests__/__snapshots__/DomainTabs.spec.js.snap +10 -5
- package/src/taxonomy/components/__tests__/__snapshots__/DomainTaxonomy.spec.js.snap +37 -29
- package/src/taxonomy/components/__tests__/__snapshots__/Domains.spec.js.snap +123 -6
- package/src/taxonomy/components/__tests__/__snapshots__/DomainsActions.spec.js.snap +2 -1
- package/src/taxonomy/components/__tests__/__snapshots__/EditDomain.spec.js.snap +15 -14
- package/src/taxonomy/components/__tests__/__snapshots__/NewDomain.spec.js.snap +31 -28
- package/src/taxonomy/selectors/index.js +0 -1
- package/src/concepts/relations/components/__tests__/ConceptSelector2.spec.js +0 -76
- package/src/concepts/selectors/__tests__/getConceptSubscope.spec.js +0 -37
- package/src/concepts/selectors/__tests__/getSidemenuGlossarySubscopes.spec.js +0 -17
- package/src/concepts/selectors/getConceptStatus.js +0 -1
- package/src/concepts/selectors/getConceptSubscope.js +0 -19
- package/src/concepts/selectors/getSidemenuGlossarySubscopes.js +0 -8
|
@@ -1,10 +1,9 @@
|
|
|
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 { ConceptsTable } from "../ConceptsTable";
|
|
5
4
|
|
|
6
|
-
jest.mock("react-router
|
|
7
|
-
...jest.requireActual("react-router
|
|
5
|
+
jest.mock("react-router", () => ({
|
|
6
|
+
...jest.requireActual("react-router"),
|
|
8
7
|
useLocation: jest.fn(),
|
|
9
8
|
}));
|
|
10
9
|
|
|
@@ -48,15 +47,6 @@ const searchProps = {
|
|
|
48
47
|
translations: jest.fn(),
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
const renderOpts = {
|
|
52
|
-
messages: {
|
|
53
|
-
en: {
|
|
54
|
-
"concepts.props.type": "Type",
|
|
55
|
-
"concepts.props.name": "Term",
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
50
|
describe("<ConceptsTable />", () => {
|
|
61
51
|
const controlColumn = { name: "controlColumn" };
|
|
62
52
|
const defaultColumns = ["name", "status", "globalPublished"].map((name) => ({
|
|
@@ -76,15 +66,14 @@ describe("<ConceptsTable />", () => {
|
|
|
76
66
|
|
|
77
67
|
it(`matches the latest snapshot`, async () => {
|
|
78
68
|
jest
|
|
79
|
-
.spyOn(require("react-router
|
|
69
|
+
.spyOn(require("react-router"), "useLocation")
|
|
80
70
|
.mockReturnValue({ pathname: "/concepts" });
|
|
81
71
|
|
|
82
72
|
const props = { columnsByScope };
|
|
83
73
|
const { container, findByText } = render(
|
|
84
74
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
85
75
|
<ConceptsTable {...props} />
|
|
86
|
-
</SearchContextProvider
|
|
87
|
-
renderOpts
|
|
76
|
+
</SearchContextProvider>
|
|
88
77
|
);
|
|
89
78
|
await findByText(/concepts.props.controlColumn/);
|
|
90
79
|
expect(container).toMatchSnapshot();
|
|
@@ -92,15 +81,14 @@ describe("<ConceptsTable />", () => {
|
|
|
92
81
|
|
|
93
82
|
it(`default columns`, async () => {
|
|
94
83
|
jest
|
|
95
|
-
.spyOn(require("react-router
|
|
84
|
+
.spyOn(require("react-router"), "useLocation")
|
|
96
85
|
.mockReturnValue({ pathname: "/concepts" });
|
|
97
86
|
|
|
98
87
|
const props = { columnsByScope };
|
|
99
88
|
const { findByText, queryByText } = render(
|
|
100
89
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
101
90
|
<ConceptsTable {...props} />
|
|
102
|
-
</SearchContextProvider
|
|
103
|
-
renderOpts
|
|
91
|
+
</SearchContextProvider>
|
|
104
92
|
);
|
|
105
93
|
await findByText(/concepts.props.controlColumn/);
|
|
106
94
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
@@ -108,15 +96,14 @@ describe("<ConceptsTable />", () => {
|
|
|
108
96
|
|
|
109
97
|
it(`subscope columns`, async () => {
|
|
110
98
|
jest
|
|
111
|
-
.spyOn(require("react-router
|
|
99
|
+
.spyOn(require("react-router"), "useLocation")
|
|
112
100
|
.mockReturnValue({ pathname: "/concepts/subscoped" });
|
|
113
101
|
|
|
114
102
|
const props = { columnsByScope };
|
|
115
103
|
const { findByText, queryByText } = render(
|
|
116
104
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
117
105
|
<ConceptsTable {...props} />
|
|
118
|
-
</SearchContextProvider
|
|
119
|
-
renderOpts
|
|
106
|
+
</SearchContextProvider>
|
|
120
107
|
);
|
|
121
108
|
await findByText(/concepts.props.controlColumn/);
|
|
122
109
|
expect(queryByText(/subscoped/)).toBeInTheDocument();
|
|
@@ -124,7 +111,7 @@ describe("<ConceptsTable />", () => {
|
|
|
124
111
|
|
|
125
112
|
it(`subscope default fallback columns`, async () => {
|
|
126
113
|
jest
|
|
127
|
-
.spyOn(require("react-router
|
|
114
|
+
.spyOn(require("react-router"), "useLocation")
|
|
128
115
|
.mockReturnValue({ pathname: "/concepts/subscoped" });
|
|
129
116
|
|
|
130
117
|
const fallbackColumns = {
|
|
@@ -135,8 +122,7 @@ describe("<ConceptsTable />", () => {
|
|
|
135
122
|
const { findByText, queryByText } = render(
|
|
136
123
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
137
124
|
<ConceptsTable {...props} />
|
|
138
|
-
</SearchContextProvider
|
|
139
|
-
renderOpts
|
|
125
|
+
</SearchContextProvider>
|
|
140
126
|
);
|
|
141
127
|
await findByText(/concepts.props.controlColumn/);
|
|
142
128
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
@@ -144,15 +130,14 @@ describe("<ConceptsTable />", () => {
|
|
|
144
130
|
|
|
145
131
|
it(`pending columns`, async () => {
|
|
146
132
|
jest
|
|
147
|
-
.spyOn(require("react-router
|
|
133
|
+
.spyOn(require("react-router"), "useLocation")
|
|
148
134
|
.mockReturnValue({ pathname: "/concepts/pending" });
|
|
149
135
|
|
|
150
136
|
const props = { columnsByScope };
|
|
151
137
|
const { findByText, queryByText } = render(
|
|
152
138
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
153
139
|
<ConceptsTable {...props} />
|
|
154
|
-
</SearchContextProvider
|
|
155
|
-
renderOpts
|
|
140
|
+
</SearchContextProvider>
|
|
156
141
|
);
|
|
157
142
|
await findByText(/concepts.props.controlColumn/);
|
|
158
143
|
expect(queryByText(/globalPending/)).toBeInTheDocument();
|
|
@@ -160,7 +145,7 @@ describe("<ConceptsTable />", () => {
|
|
|
160
145
|
|
|
161
146
|
it(`pending default fallback columns`, async () => {
|
|
162
147
|
jest
|
|
163
|
-
.spyOn(require("react-router
|
|
148
|
+
.spyOn(require("react-router"), "useLocation")
|
|
164
149
|
.mockReturnValue({ pathname: "/concepts/pending" });
|
|
165
150
|
|
|
166
151
|
const fallbackColumns = {
|
|
@@ -171,8 +156,7 @@ describe("<ConceptsTable />", () => {
|
|
|
171
156
|
const { findByText, queryByText } = render(
|
|
172
157
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
173
158
|
<ConceptsTable {...props} />
|
|
174
|
-
</SearchContextProvider
|
|
175
|
-
renderOpts
|
|
159
|
+
</SearchContextProvider>
|
|
176
160
|
);
|
|
177
161
|
await findByText(/concepts.props.controlColumn/);
|
|
178
162
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
@@ -180,15 +164,14 @@ describe("<ConceptsTable />", () => {
|
|
|
180
164
|
|
|
181
165
|
it(`deprecated columns`, async () => {
|
|
182
166
|
jest
|
|
183
|
-
.spyOn(require("react-router
|
|
167
|
+
.spyOn(require("react-router"), "useLocation")
|
|
184
168
|
.mockReturnValue({ pathname: "/concepts/deprecated" });
|
|
185
169
|
|
|
186
170
|
const props = { columnsByScope };
|
|
187
171
|
const { findByText, queryByText } = render(
|
|
188
172
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
189
173
|
<ConceptsTable {...props} />
|
|
190
|
-
</SearchContextProvider
|
|
191
|
-
renderOpts
|
|
174
|
+
</SearchContextProvider>
|
|
192
175
|
);
|
|
193
176
|
await findByText(/concepts.props.controlColumn/);
|
|
194
177
|
expect(queryByText(/globalDeprecated/)).toBeInTheDocument();
|
|
@@ -196,7 +179,7 @@ describe("<ConceptsTable />", () => {
|
|
|
196
179
|
|
|
197
180
|
it(`deprecated default fallback columns`, async () => {
|
|
198
181
|
jest
|
|
199
|
-
.spyOn(require("react-router
|
|
182
|
+
.spyOn(require("react-router"), "useLocation")
|
|
200
183
|
.mockReturnValue({ pathname: "/concepts/deprecated" });
|
|
201
184
|
|
|
202
185
|
const fallbackColumns = {
|
|
@@ -207,15 +190,14 @@ describe("<ConceptsTable />", () => {
|
|
|
207
190
|
const { findByText, queryByText } = render(
|
|
208
191
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
209
192
|
<ConceptsTable {...props} />
|
|
210
|
-
</SearchContextProvider
|
|
211
|
-
renderOpts
|
|
193
|
+
</SearchContextProvider>
|
|
212
194
|
);
|
|
213
195
|
await findByText(/concepts.props.controlColumn/);
|
|
214
196
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
215
197
|
});
|
|
216
198
|
|
|
217
199
|
it(`menu-subscoped published columns`, async () => {
|
|
218
|
-
jest.spyOn(require("react-router
|
|
200
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
219
201
|
pathname: "/glossarySubscope/menusubscoped/published",
|
|
220
202
|
});
|
|
221
203
|
|
|
@@ -223,15 +205,14 @@ describe("<ConceptsTable />", () => {
|
|
|
223
205
|
const { findByText, queryByText } = render(
|
|
224
206
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
225
207
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
226
|
-
</SearchContextProvider
|
|
227
|
-
renderOpts
|
|
208
|
+
</SearchContextProvider>
|
|
228
209
|
);
|
|
229
210
|
await findByText(/concepts.props.controlColumn/);
|
|
230
211
|
expect(queryByText(/menuscopedPublished/)).toBeInTheDocument();
|
|
231
212
|
});
|
|
232
213
|
|
|
233
214
|
it(`menu-subscoped default published fallback columns`, async () => {
|
|
234
|
-
jest.spyOn(require("react-router
|
|
215
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
235
216
|
pathname: "/glossarySubscope/menusubscoped/published",
|
|
236
217
|
});
|
|
237
218
|
|
|
@@ -243,15 +224,14 @@ describe("<ConceptsTable />", () => {
|
|
|
243
224
|
const { findByText, queryByText } = render(
|
|
244
225
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
245
226
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
246
|
-
</SearchContextProvider
|
|
247
|
-
renderOpts
|
|
227
|
+
</SearchContextProvider>
|
|
248
228
|
);
|
|
249
229
|
await findByText(/concepts.props.controlColumn/);
|
|
250
230
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
251
231
|
});
|
|
252
232
|
|
|
253
233
|
it(`menu-subscoped pending columns`, async () => {
|
|
254
|
-
jest.spyOn(require("react-router
|
|
234
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
255
235
|
pathname: "/glossarySubscope/menusubscoped/pending",
|
|
256
236
|
});
|
|
257
237
|
|
|
@@ -259,15 +239,14 @@ describe("<ConceptsTable />", () => {
|
|
|
259
239
|
const { findByText, queryByText } = render(
|
|
260
240
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
261
241
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
262
|
-
</SearchContextProvider
|
|
263
|
-
renderOpts
|
|
242
|
+
</SearchContextProvider>
|
|
264
243
|
);
|
|
265
244
|
await findByText(/concepts.props.controlColumn/);
|
|
266
245
|
expect(queryByText(/menuscopedPending/)).toBeInTheDocument();
|
|
267
246
|
});
|
|
268
247
|
|
|
269
248
|
it(`menu-subscoped pending fallback columns`, async () => {
|
|
270
|
-
jest.spyOn(require("react-router
|
|
249
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
271
250
|
pathname: "/glossarySubscope/menusubscoped/pending",
|
|
272
251
|
});
|
|
273
252
|
|
|
@@ -280,15 +259,14 @@ describe("<ConceptsTable />", () => {
|
|
|
280
259
|
const { findByText, queryByText } = render(
|
|
281
260
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
282
261
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
283
|
-
</SearchContextProvider
|
|
284
|
-
renderOpts
|
|
262
|
+
</SearchContextProvider>
|
|
285
263
|
);
|
|
286
264
|
await findByText(/concepts.props.controlColumn/);
|
|
287
265
|
expect(queryByText(/globalPending/)).toBeInTheDocument();
|
|
288
266
|
});
|
|
289
267
|
|
|
290
268
|
it(`menu-subscoped default pending fallback columns`, async () => {
|
|
291
|
-
jest.spyOn(require("react-router
|
|
269
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
292
270
|
pathname: "/glossarySubscope/menusubscoped/deprecated",
|
|
293
271
|
});
|
|
294
272
|
|
|
@@ -300,15 +278,14 @@ describe("<ConceptsTable />", () => {
|
|
|
300
278
|
const { findByText, queryByText } = render(
|
|
301
279
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
302
280
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
303
|
-
</SearchContextProvider
|
|
304
|
-
renderOpts
|
|
281
|
+
</SearchContextProvider>
|
|
305
282
|
);
|
|
306
283
|
await findByText(/concepts.props.controlColumn/);
|
|
307
284
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
308
285
|
});
|
|
309
286
|
|
|
310
287
|
it(`menu-subscoped deprecated columns`, async () => {
|
|
311
|
-
jest.spyOn(require("react-router
|
|
288
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
312
289
|
pathname: "/glossarySubscope/menusubscoped/deprecated",
|
|
313
290
|
});
|
|
314
291
|
|
|
@@ -316,15 +293,14 @@ describe("<ConceptsTable />", () => {
|
|
|
316
293
|
const { findByText, queryByText } = render(
|
|
317
294
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
318
295
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
319
|
-
</SearchContextProvider
|
|
320
|
-
renderOpts
|
|
296
|
+
</SearchContextProvider>
|
|
321
297
|
);
|
|
322
298
|
await findByText(/concepts.props.controlColumn/);
|
|
323
299
|
expect(queryByText(/menuscopedDeprecated/)).toBeInTheDocument();
|
|
324
300
|
});
|
|
325
301
|
|
|
326
302
|
it(`menu-subscoped deprecated fallback columns`, async () => {
|
|
327
|
-
jest.spyOn(require("react-router
|
|
303
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
328
304
|
pathname: "/glossarySubscope/menusubscoped/deprecated",
|
|
329
305
|
});
|
|
330
306
|
|
|
@@ -337,15 +313,14 @@ describe("<ConceptsTable />", () => {
|
|
|
337
313
|
const { findByText, queryByText } = render(
|
|
338
314
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
339
315
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
340
|
-
</SearchContextProvider
|
|
341
|
-
renderOpts
|
|
316
|
+
</SearchContextProvider>
|
|
342
317
|
);
|
|
343
318
|
await findByText(/concepts.props.controlColumn/);
|
|
344
319
|
expect(queryByText(/globalDeprecated/)).toBeInTheDocument();
|
|
345
320
|
});
|
|
346
321
|
|
|
347
322
|
it(`menu-subscoped default deprecated fallback columns`, async () => {
|
|
348
|
-
jest.spyOn(require("react-router
|
|
323
|
+
jest.spyOn(require("react-router"), "useLocation").mockReturnValue({
|
|
349
324
|
pathname: "/glossarySubscope/menusubscoped/deprecated",
|
|
350
325
|
});
|
|
351
326
|
|
|
@@ -357,8 +332,7 @@ describe("<ConceptsTable />", () => {
|
|
|
357
332
|
const { findByText, queryByText } = render(
|
|
358
333
|
<SearchContextProvider {...searchProps} defaultFilters={{}}>
|
|
359
334
|
<ConceptsTable {...props} subscope="menusubscoped" />
|
|
360
|
-
</SearchContextProvider
|
|
361
|
-
renderOpts
|
|
335
|
+
</SearchContextProvider>
|
|
362
336
|
);
|
|
363
337
|
await findByText(/concepts.props.controlColumn/);
|
|
364
338
|
expect(queryByText(/globalPublished/)).toBeInTheDocument();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render } from "@truedat/test/render";
|
|
3
2
|
import SearchContext from "@truedat/core/search/SearchContext";
|
|
4
3
|
import { ConceptsUpdateButton } from "../ConceptsUpdateButton";
|
|
@@ -7,8 +6,8 @@ jest.mock("@truedat/core/hooks", () => ({
|
|
|
7
6
|
useAuthorized: jest.fn(() => true),
|
|
8
7
|
}));
|
|
9
8
|
|
|
10
|
-
jest.mock("react-router
|
|
11
|
-
...jest.requireActual("react-router
|
|
9
|
+
jest.mock("react-router", () => ({
|
|
10
|
+
...jest.requireActual("react-router"),
|
|
12
11
|
useLocation: () => ({ pathname: "/concept" }),
|
|
13
12
|
}));
|
|
14
13
|
|
|
@@ -26,18 +25,18 @@ const searchProps = {
|
|
|
26
25
|
describe("<ConceptsUpdateButton />", () => {
|
|
27
26
|
it("button will appear disabled if template is empty", () => {
|
|
28
27
|
const { getByRole } = render(
|
|
29
|
-
<SearchContext
|
|
28
|
+
<SearchContext value={searchProps}>
|
|
30
29
|
<ConceptsUpdateButton />
|
|
31
|
-
</SearchContext
|
|
30
|
+
</SearchContext>
|
|
32
31
|
);
|
|
33
32
|
expect(getByRole("button", { name: /Update/i })).toBeEnabled();
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
it("matches the latest snapshot", () => {
|
|
37
36
|
const { container } = render(
|
|
38
|
-
<SearchContext
|
|
37
|
+
<SearchContext value={searchProps}>
|
|
39
38
|
<ConceptsUpdateButton />
|
|
40
|
-
</SearchContext
|
|
39
|
+
</SearchContext>
|
|
41
40
|
);
|
|
42
41
|
expect(container).toMatchSnapshot();
|
|
43
42
|
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
4
|
-
import { screen, waitFor } from "@testing-library/react";
|
|
1
|
+
import { waitFor } from "@testing-library/react";
|
|
5
2
|
import userEvent from "@testing-library/user-event";
|
|
6
|
-
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
7
4
|
import { ConceptsUploadButton } from "../ConceptsUploadButton";
|
|
8
5
|
|
|
6
|
+
jest.mock("react-dropzone", () => ({
|
|
7
|
+
useDropzone: jest.fn(() => ({
|
|
8
|
+
getRootProps: jest.fn(),
|
|
9
|
+
getInputProps: jest.fn(),
|
|
10
|
+
isDragActive: false,
|
|
11
|
+
open: jest.fn(),
|
|
12
|
+
})),
|
|
13
|
+
}));
|
|
14
|
+
|
|
9
15
|
jest.mock("@truedat/core/hooks", () => ({
|
|
10
16
|
useAuthorized: jest.fn(() => true),
|
|
11
17
|
}));
|
|
@@ -18,28 +24,34 @@ const props = {
|
|
|
18
24
|
|
|
19
25
|
describe("<ConceptsUploadButton />", () => {
|
|
20
26
|
it("matches the latest snapshot", async () => {
|
|
21
|
-
const
|
|
22
|
-
|
|
27
|
+
const user = userEvent.setup({ delay: null });
|
|
28
|
+
const rendered = render(<ConceptsUploadButton {...props} />);
|
|
29
|
+
await waitForLoad(rendered);
|
|
30
|
+
|
|
31
|
+
await user.click(rendered.getByRole("button"));
|
|
23
32
|
await waitFor(() =>
|
|
24
|
-
expect(
|
|
33
|
+
expect(rendered.getByRole("presentation")).toBeInTheDocument()
|
|
25
34
|
);
|
|
26
35
|
|
|
27
|
-
expect(
|
|
36
|
+
expect(rendered.container).toMatchSnapshot();
|
|
28
37
|
});
|
|
29
38
|
|
|
30
39
|
it("autopublish button is displayed if canAutoPublish is true", async () => {
|
|
40
|
+
const user = userEvent.setup({ delay: null });
|
|
31
41
|
const customProps = {
|
|
32
42
|
...props,
|
|
33
43
|
canAutoPublish: true,
|
|
34
44
|
};
|
|
35
|
-
const
|
|
36
|
-
|
|
45
|
+
const rendered = render(<ConceptsUploadButton {...customProps} />);
|
|
46
|
+
await waitForLoad(rendered);
|
|
47
|
+
|
|
48
|
+
await user.click(rendered.getByRole("button"));
|
|
37
49
|
await waitFor(() =>
|
|
38
|
-
expect(
|
|
50
|
+
expect(rendered.getByRole("presentation")).toBeInTheDocument()
|
|
39
51
|
);
|
|
40
52
|
|
|
41
53
|
expect(
|
|
42
|
-
|
|
54
|
+
rendered.getByRole("button", { name: /publish/i })
|
|
43
55
|
).toBeInTheDocument();
|
|
44
56
|
});
|
|
45
57
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import userEvent from "@testing-library/user-event";
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
3
|
import ConceptsUploadEventsTable from "../ConceptsUploadEventsTable";
|
|
5
4
|
|
|
6
5
|
const events = [
|
|
@@ -83,16 +82,19 @@ jest.mock("../../hooks/useUploadEvents.js", () => {
|
|
|
83
82
|
});
|
|
84
83
|
|
|
85
84
|
describe("<ConceptsUploadEventsTable />", () => {
|
|
86
|
-
it("matches the latest snapshot", () => {
|
|
87
|
-
const
|
|
88
|
-
|
|
85
|
+
it("matches the latest snapshot", async () => {
|
|
86
|
+
const rendered = render(<ConceptsUploadEventsTable />);
|
|
87
|
+
await waitForLoad(rendered);
|
|
88
|
+
expect(rendered.container).toMatchSnapshot();
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
it("toggles row horizontal view when row is clicked", () => {
|
|
92
|
-
const
|
|
93
|
-
const
|
|
91
|
+
it("toggles row horizontal view when row is clicked", async () => {
|
|
92
|
+
const user = userEvent.setup({ delay: null });
|
|
93
|
+
const rendered = render(<ConceptsUploadEventsTable />);
|
|
94
|
+
await waitForLoad(rendered);
|
|
95
|
+
const dataRow = rendered.getAllByRole("row")[1];
|
|
94
96
|
expect(dataRow).toHaveClass("contracted");
|
|
95
|
-
|
|
97
|
+
await user.click(dataRow);
|
|
96
98
|
expect(dataRow).toHaveClass("expanded");
|
|
97
99
|
});
|
|
98
100
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { shallow } from "enzyme";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { Events } from "../Events";
|
|
4
3
|
|
|
5
4
|
describe("<Events />", () => {
|
|
6
|
-
it("matches the latest snapshot", () => {
|
|
5
|
+
it("matches the latest snapshot", async () => {
|
|
7
6
|
const events = [
|
|
8
7
|
{
|
|
9
8
|
id: 1,
|
|
@@ -11,8 +10,8 @@ describe("<Events />", () => {
|
|
|
11
10
|
resource_id: 2,
|
|
12
11
|
payload: [
|
|
13
12
|
{ field: "Ou", value: 5 },
|
|
14
|
-
{ field: "id", value: 6 }
|
|
15
|
-
]
|
|
13
|
+
{ field: "id", value: 6 },
|
|
14
|
+
],
|
|
16
15
|
},
|
|
17
16
|
{
|
|
18
17
|
id: 2,
|
|
@@ -20,12 +19,13 @@ describe("<Events />", () => {
|
|
|
20
19
|
resource_id: 2,
|
|
21
20
|
payload: [
|
|
22
21
|
{ field: "Ou", value: 7 },
|
|
23
|
-
{ field: "id", value: 3 }
|
|
24
|
-
]
|
|
25
|
-
}
|
|
22
|
+
{ field: "id", value: 3 },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
26
25
|
];
|
|
27
26
|
const props = { events };
|
|
28
|
-
const
|
|
29
|
-
|
|
27
|
+
const rendered = render(<Events {...props} />);
|
|
28
|
+
await waitForLoad(rendered);
|
|
29
|
+
expect(rendered.container).toMatchSnapshot();
|
|
30
30
|
});
|
|
31
31
|
});
|
|
@@ -1,34 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { intl } from "@truedat/test/intl-stub";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
4
3
|
import { SharedToDomains } from "../SharedToDomains";
|
|
5
4
|
|
|
6
|
-
// workaround for enzyme issue with React.useContext
|
|
7
|
-
// see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
|
|
8
|
-
jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
9
|
-
|
|
10
5
|
describe("<SharedToDomains />", () => {
|
|
11
|
-
const sharedTo = [
|
|
6
|
+
const sharedTo = [
|
|
7
|
+
{
|
|
8
|
+
id: 1,
|
|
9
|
+
name: "foo",
|
|
10
|
+
external_id: "bar",
|
|
11
|
+
parents: [{ name: "parent1" }, { name: "parent2" }],
|
|
12
|
+
},
|
|
13
|
+
];
|
|
12
14
|
const props = {
|
|
13
15
|
loading: false,
|
|
14
|
-
sharedTo
|
|
16
|
+
sharedTo,
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
it("matches the latest snapshot", () => {
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
it("matches the latest snapshot", async () => {
|
|
20
|
+
const rendered = render(<SharedToDomains {...props} />);
|
|
21
|
+
await waitForLoad(rendered);
|
|
22
|
+
expect(rendered.container).toMatchSnapshot();
|
|
20
23
|
});
|
|
21
24
|
|
|
22
|
-
it("renders
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
it("renders domains", async () => {
|
|
26
|
+
const rendered = render(<SharedToDomains {...props} />);
|
|
27
|
+
await waitForLoad(rendered);
|
|
28
|
+
expect(rendered.queryByText("parent1")).toBeInTheDocument();
|
|
29
|
+
expect(rendered.queryByText("parent2")).toBeInTheDocument();
|
|
25
30
|
});
|
|
26
31
|
|
|
27
|
-
it("renders Loading when loading is true", () => {
|
|
28
|
-
const
|
|
32
|
+
it("renders Loading when loading is true", async () => {
|
|
33
|
+
const rendered = render(
|
|
29
34
|
<SharedToDomains {...{ ...props, loading: true }} />
|
|
30
35
|
);
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
await waitFor(() => {
|
|
37
|
+
expect(rendered.container.querySelector(".loader")).toBeInTheDocument();
|
|
38
|
+
});
|
|
33
39
|
});
|
|
34
40
|
});
|
|
@@ -1,47 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
4
|
import { SharedToDomainsPopup } from "../SharedToDomainsPopup";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
jest.mock(
|
|
7
|
+
"../SharedToForm",
|
|
8
|
+
() =>
|
|
9
|
+
function SharedToForm() {
|
|
10
|
+
return <div>SharedToForm</div>;
|
|
11
|
+
}
|
|
12
|
+
);
|
|
10
13
|
|
|
11
14
|
describe("<SharedToDomainsPopup />", () => {
|
|
12
15
|
const props = {
|
|
13
|
-
saving: false
|
|
16
|
+
saving: false,
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
it("matches the latest snapshot", () => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
+
it("matches the latest snapshot", async () => {
|
|
20
|
+
const rendered = render(<SharedToDomainsPopup {...props} />);
|
|
21
|
+
await waitForLoad(rendered);
|
|
22
|
+
expect(rendered.container).toMatchSnapshot();
|
|
19
23
|
});
|
|
20
24
|
|
|
21
|
-
it("manages open and close popup", () => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
it("manages open and close popup", async () => {
|
|
26
|
+
const user = userEvent.setup({ delay: null });
|
|
27
|
+
const rendered = render(<SharedToDomainsPopup {...props} />);
|
|
28
|
+
await waitForLoad(rendered);
|
|
29
|
+
|
|
30
|
+
const triggerButton = rendered.getByRole("button");
|
|
31
|
+
// Initially closed
|
|
32
|
+
expect(rendered.queryByText(/sharedtoform/i)).not.toBeInTheDocument();
|
|
33
|
+
|
|
34
|
+
// Open popup
|
|
35
|
+
await user.click(triggerButton);
|
|
36
|
+
await waitFor(() =>
|
|
37
|
+
expect(rendered.getByText(/sharedtoform/i)).toBeInTheDocument()
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Close popup by clicking button again
|
|
41
|
+
await user.click(triggerButton);
|
|
42
|
+
await waitFor(() =>
|
|
43
|
+
expect(rendered.queryByText(/sharedtoform/i)).not.toBeInTheDocument()
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Open popup again
|
|
47
|
+
await user.click(triggerButton);
|
|
48
|
+
await waitFor(() =>
|
|
49
|
+
expect(rendered.getByText(/sharedtoform/i)).toBeInTheDocument()
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// Close popup when saving is true
|
|
53
|
+
rendered.rerender(<SharedToDomainsPopup saving={true} />);
|
|
54
|
+
rendered.rerender(<SharedToDomainsPopup saving={false} />);
|
|
55
|
+
await waitFor(() =>
|
|
56
|
+
expect(rendered.queryByText(/sharedtoform/i)).not.toBeInTheDocument()
|
|
57
|
+
);
|
|
46
58
|
});
|
|
47
59
|
});
|