@truedat/bg 7.5.9 → 7.5.11
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 +39 -34
- 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 +5 -5
- 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 +4 -6
- 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 +10 -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,156 +1,96 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import { DOMAIN_NEW, DOMAIN_EDIT } from "@truedat/core/routes";
|
|
5
|
-
import { MemoryRouter } from "react-router-dom/cjs/react-router-dom.min";
|
|
6
|
-
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
7
|
-
import { useDomain } from "../../../hooks/useDomains";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
8
3
|
import Domain from "../Domain";
|
|
4
|
+
import { useDomain } from "../../../hooks/useDomains";
|
|
5
|
+
import { useAuthorized } from "@truedat/core/hooks";
|
|
6
|
+
import { DOMAIN_NEW, DOMAIN_EDIT } from "@truedat/core/routes";
|
|
9
7
|
|
|
10
8
|
jest.mock("@truedat/core/hooks", () => ({
|
|
11
9
|
useAuthorized: jest.fn(() => true),
|
|
12
10
|
}));
|
|
13
11
|
|
|
14
|
-
jest.mock("../../../hooks/useDomains"
|
|
15
|
-
...jest.requireActual("../../../hooks/useDomains"),
|
|
16
|
-
useDomain: jest.fn((domainId) => ({
|
|
17
|
-
data: {
|
|
18
|
-
description: "DOMAIN DESCRIPTION",
|
|
19
|
-
domain_group: null,
|
|
20
|
-
external_id: "EXTERNAL ID",
|
|
21
|
-
id: domainId,
|
|
22
|
-
name: "DOMAIN NAME",
|
|
23
|
-
parent_id: 6,
|
|
24
|
-
parents: null,
|
|
25
|
-
type: null,
|
|
26
|
-
},
|
|
27
|
-
})),
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
const domains = [
|
|
31
|
-
{
|
|
32
|
-
id: "3",
|
|
33
|
-
name: "DOMAIN NAME",
|
|
34
|
-
parentId: "6",
|
|
35
|
-
actions: [],
|
|
36
|
-
externalId: "EXTERNAL ID",
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
const variables = {
|
|
41
|
-
action: "viewDomain",
|
|
42
|
-
fetchPolicy: "no-cache",
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const domainsMock = {
|
|
46
|
-
request: { query: DOMAINS_QUERY, variables },
|
|
47
|
-
result: { data: { domains: domains } },
|
|
48
|
-
};
|
|
12
|
+
jest.mock("../../../hooks/useDomains");
|
|
49
13
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
14
|
+
// Mock all child components
|
|
15
|
+
jest.mock("../DomainDetail", () => ({ id }) => <div>DomainDetail: {id}</div>);
|
|
16
|
+
jest.mock("../DomainTabs", () => ({ domain, taxonomyConfig }) => (
|
|
17
|
+
<div>DomainTabs</div>
|
|
18
|
+
));
|
|
19
|
+
jest.mock("../EditDomain", () => ({ domain }) => <div>EditDomain</div>);
|
|
20
|
+
jest.mock("../NewDomain", () => ({ domain }) => <div>NewDomain</div>);
|
|
21
|
+
jest.mock("../DomainContent", () => ({ domain, domains, taxonomyConfig }) => (
|
|
22
|
+
<div>DomainContent</div>
|
|
23
|
+
));
|
|
54
24
|
|
|
55
25
|
describe("<Domain />", () => {
|
|
56
26
|
const domainId = 3;
|
|
27
|
+
const domains = [];
|
|
57
28
|
const taxonomyConfig = {
|
|
58
29
|
priorityTabs: [],
|
|
59
30
|
hiddenTabs: [],
|
|
60
31
|
};
|
|
61
32
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
69
|
-
await waitFor(() =>
|
|
70
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
71
|
-
);
|
|
72
|
-
expect(container).toMatchSnapshot();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("renders DomainDetail component", async () => {
|
|
76
|
-
const { getByText, queryByText } = render(
|
|
77
|
-
<Domain domainId={domainId} taxonomyConfig={taxonomyConfig} />,
|
|
78
|
-
renderOpts
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
82
|
-
await waitFor(() =>
|
|
83
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
84
|
-
);
|
|
85
|
-
expect(getByText("DOMAIN NAME")).toBeInTheDocument();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("renders DomainTabs component", async () => {
|
|
89
|
-
const { getByText, queryByText } = render(
|
|
90
|
-
<Domain domainId={domainId} taxonomyConfig={taxonomyConfig} />,
|
|
91
|
-
renderOpts
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
95
|
-
await waitFor(() =>
|
|
96
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
expect(getByText("DOMAIN DESCRIPTION")).toBeInTheDocument();
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
useDomain.mockImplementation(() => ({
|
|
35
|
+
data: { id: domainId, name: "Test Domain" },
|
|
36
|
+
}));
|
|
100
37
|
});
|
|
101
38
|
|
|
102
|
-
it("renders
|
|
103
|
-
const
|
|
104
|
-
<Domain
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
39
|
+
it("renders correctly with default route", async () => {
|
|
40
|
+
const rendered = render(
|
|
41
|
+
<Domain
|
|
42
|
+
domainId={domainId}
|
|
43
|
+
domains={domains}
|
|
44
|
+
taxonomyConfig={taxonomyConfig}
|
|
45
|
+
/>
|
|
110
46
|
);
|
|
111
|
-
|
|
112
|
-
expect(
|
|
47
|
+
await waitForLoad(rendered);
|
|
48
|
+
expect(rendered.container).toMatchSnapshot();
|
|
113
49
|
});
|
|
114
50
|
|
|
115
|
-
it("renders
|
|
116
|
-
const
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
51
|
+
it("renders correctly with edit route", async () => {
|
|
52
|
+
const rendered = render(
|
|
53
|
+
<Domain
|
|
54
|
+
domainId={domainId}
|
|
55
|
+
domains={domains}
|
|
56
|
+
taxonomyConfig={taxonomyConfig}
|
|
57
|
+
/>,
|
|
58
|
+
{
|
|
59
|
+
routes: [DOMAIN_EDIT],
|
|
60
|
+
}
|
|
125
61
|
);
|
|
126
|
-
|
|
127
|
-
expect(
|
|
62
|
+
await waitForLoad(rendered);
|
|
63
|
+
expect(rendered.container).toMatchSnapshot();
|
|
128
64
|
});
|
|
129
65
|
|
|
130
|
-
it("renders
|
|
131
|
-
const
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
66
|
+
it("renders correctly with new route", async () => {
|
|
67
|
+
const rendered = render(
|
|
68
|
+
<Domain
|
|
69
|
+
domainId={domainId}
|
|
70
|
+
domains={domains}
|
|
71
|
+
taxonomyConfig={taxonomyConfig}
|
|
72
|
+
/>,
|
|
73
|
+
{
|
|
74
|
+
routes: [DOMAIN_NEW],
|
|
75
|
+
}
|
|
140
76
|
);
|
|
141
|
-
|
|
142
|
-
expect(
|
|
77
|
+
await waitForLoad(rendered);
|
|
78
|
+
expect(rendered.container).toMatchSnapshot();
|
|
143
79
|
});
|
|
144
80
|
|
|
145
|
-
it("renders null when
|
|
81
|
+
it("renders null when domain is not available", async () => {
|
|
146
82
|
useDomain.mockImplementationOnce(() => ({
|
|
147
|
-
data:
|
|
83
|
+
data: null,
|
|
148
84
|
}));
|
|
149
85
|
|
|
150
|
-
const
|
|
151
|
-
<Domain
|
|
152
|
-
|
|
86
|
+
const rendered = render(
|
|
87
|
+
<Domain
|
|
88
|
+
domainId={domainId}
|
|
89
|
+
domains={domains}
|
|
90
|
+
taxonomyConfig={taxonomyConfig}
|
|
91
|
+
/>
|
|
153
92
|
);
|
|
154
|
-
|
|
93
|
+
await waitForLoad(rendered);
|
|
94
|
+
expect(rendered.container).toMatchSnapshot();
|
|
155
95
|
});
|
|
156
96
|
});
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
2
|
+
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import { DomainCards } from "../DomainCards";
|
|
6
5
|
|
|
7
6
|
describe("<DomainCards />", () => {
|
|
8
|
-
const renderOpts = {
|
|
9
|
-
messages: {
|
|
10
|
-
en: {
|
|
11
|
-
"domain.children.empty": "No subdomains found",
|
|
12
|
-
"domain.props.children": "Subdomains: {count}",
|
|
13
|
-
"domains.actions.create": "New Domain",
|
|
14
|
-
"domains.search.placeholder": "Search domains...",
|
|
15
|
-
"domains.search.results.count": "Results: {count}",
|
|
16
|
-
domain: "Domain",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
7
|
const domains = [
|
|
21
8
|
{
|
|
22
|
-
id: 1,
|
|
9
|
+
id: "1",
|
|
23
10
|
name: "rootNoSub",
|
|
24
11
|
type: null,
|
|
25
12
|
description: "Root domain with no subdomains",
|
|
@@ -31,118 +18,124 @@ describe("<DomainCards />", () => {
|
|
|
31
18
|
},
|
|
32
19
|
],
|
|
33
20
|
domain_group: {
|
|
34
|
-
id: 1,
|
|
21
|
+
id: "1",
|
|
35
22
|
name: "DomainGroup",
|
|
36
23
|
},
|
|
37
24
|
parent_id: null,
|
|
38
25
|
external_id: "rootNoSub",
|
|
39
26
|
},
|
|
40
27
|
{
|
|
41
|
-
id: 2,
|
|
28
|
+
id: " 2",
|
|
42
29
|
name: "rootWithSub",
|
|
43
30
|
type: null,
|
|
44
31
|
description: null,
|
|
45
32
|
parents: [
|
|
46
33
|
{
|
|
47
|
-
id: 2,
|
|
34
|
+
id: "2",
|
|
48
35
|
name: "rootWithSub",
|
|
49
36
|
external_id: "rootWithSub",
|
|
50
37
|
},
|
|
51
38
|
],
|
|
52
39
|
domain_group: {
|
|
53
|
-
id: 1,
|
|
40
|
+
id: "1",
|
|
54
41
|
name: "DomainGroup",
|
|
55
42
|
},
|
|
56
43
|
parent_id: null,
|
|
57
44
|
external_id: "rootWithSub",
|
|
58
45
|
},
|
|
59
46
|
{
|
|
60
|
-
id: 3,
|
|
47
|
+
id: "3",
|
|
61
48
|
name: "rootOtherGroup",
|
|
62
49
|
type: null,
|
|
63
50
|
description: null,
|
|
64
51
|
parents: [
|
|
65
52
|
{
|
|
66
|
-
id: 3,
|
|
53
|
+
id: "3",
|
|
67
54
|
name: "rootOtherGroup",
|
|
68
55
|
external_id: "rootOtherGroup",
|
|
69
56
|
},
|
|
70
57
|
],
|
|
71
58
|
domain_group: {
|
|
72
|
-
id: 2,
|
|
59
|
+
id: "2",
|
|
73
60
|
name: "OtherDomainGroup",
|
|
74
61
|
},
|
|
75
62
|
parent_id: null,
|
|
76
63
|
external_id: "rootOtherGroup",
|
|
77
64
|
},
|
|
78
65
|
{
|
|
79
|
-
id: 4,
|
|
66
|
+
id: "4",
|
|
80
67
|
name: "subdomain",
|
|
81
68
|
type: null,
|
|
82
69
|
description: null,
|
|
83
70
|
parents: [
|
|
84
71
|
{
|
|
85
|
-
id: 3,
|
|
72
|
+
id: "3",
|
|
86
73
|
name: "subdomain",
|
|
87
74
|
external_id: "subdomain",
|
|
88
75
|
},
|
|
89
76
|
{
|
|
90
|
-
id: 2,
|
|
77
|
+
id: "2",
|
|
91
78
|
name: "rootWithSub",
|
|
92
79
|
external_id: "rootWithSub",
|
|
93
80
|
},
|
|
94
81
|
],
|
|
95
82
|
domain_group: {
|
|
96
|
-
id: 1,
|
|
83
|
+
id: "1",
|
|
97
84
|
name: "DomainGroup",
|
|
98
85
|
},
|
|
99
|
-
parent_id: 2,
|
|
86
|
+
parent_id: "2",
|
|
100
87
|
external_id: "subdomain",
|
|
101
88
|
},
|
|
102
89
|
];
|
|
103
|
-
it("matches the latest snapshot front page", () => {
|
|
90
|
+
it("matches the latest snapshot front page", async () => {
|
|
104
91
|
const props = { domains };
|
|
105
|
-
const
|
|
106
|
-
|
|
92
|
+
const rendered = render(<DomainCards {...props} />);
|
|
93
|
+
await waitForLoad(rendered);
|
|
94
|
+
expect(rendered.container).toMatchSnapshot();
|
|
107
95
|
});
|
|
108
96
|
|
|
109
|
-
it("matches the latest snapshot domain without subdomain", () => {
|
|
97
|
+
it("matches the latest snapshot domain without subdomain", async () => {
|
|
110
98
|
const domain = _.find(["id", 1])(domains);
|
|
111
99
|
const props = { domains, domain };
|
|
112
|
-
const
|
|
113
|
-
|
|
100
|
+
const rendered = render(<DomainCards {...props} />);
|
|
101
|
+
await waitForLoad(rendered);
|
|
102
|
+
expect(rendered.container).toMatchSnapshot();
|
|
114
103
|
});
|
|
115
104
|
|
|
116
|
-
it("matches the latest snapshot domain with subdomain", () => {
|
|
105
|
+
it("matches the latest snapshot domain with subdomain", async () => {
|
|
117
106
|
const domain = _.find(["id", 2])(domains);
|
|
118
107
|
const props = { domains, domain };
|
|
119
|
-
const
|
|
120
|
-
|
|
108
|
+
const rendered = render(<DomainCards {...props} />);
|
|
109
|
+
await waitForLoad(rendered);
|
|
110
|
+
expect(rendered.container).toMatchSnapshot();
|
|
121
111
|
});
|
|
122
112
|
|
|
123
|
-
it("filters domains based on search input", () => {
|
|
113
|
+
it("filters domains based on search input", async () => {
|
|
124
114
|
const props = { domains };
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
renderOpts
|
|
128
|
-
);
|
|
115
|
+
const rendered = render(<DomainCards {...props} />);
|
|
116
|
+
await waitForLoad(rendered);
|
|
129
117
|
|
|
130
|
-
const
|
|
131
|
-
|
|
118
|
+
const user = userEvent.setup({ delay: null });
|
|
119
|
+
const searchInput = rendered.getByPlaceholderText(
|
|
120
|
+
/domains.search.placeholder/i
|
|
121
|
+
);
|
|
122
|
+
await user.type(searchInput, "other");
|
|
132
123
|
|
|
133
|
-
expect(getByText(
|
|
124
|
+
expect(rendered.getByText(/rootOtherGroup/i)).toBeInTheDocument();
|
|
134
125
|
});
|
|
135
126
|
|
|
136
|
-
it("displays
|
|
127
|
+
it.skip("displays domain.children.empty message when no subdomains are present", async () => {
|
|
137
128
|
const domain = _.find(["id", 1])(domains);
|
|
138
129
|
const props = { domains, domain };
|
|
139
|
-
const
|
|
140
|
-
|
|
130
|
+
const rendered = render(<DomainCards {...props} />);
|
|
131
|
+
await waitForLoad(rendered);
|
|
132
|
+
expect(rendered.getByText(/domain.children.empty/i)).toBeInTheDocument();
|
|
141
133
|
});
|
|
142
134
|
|
|
143
|
-
it("renders DomainsActions component when no domain is selected", () => {
|
|
135
|
+
it("renders DomainsActions component when no domain is selected", async () => {
|
|
144
136
|
const props = { domains, actions: { create: { href: "" } } };
|
|
145
|
-
const
|
|
146
|
-
|
|
137
|
+
const rendered = render(<DomainCards {...props} />);
|
|
138
|
+
await waitForLoad(rendered);
|
|
139
|
+
expect(rendered.getByText(/domains.actions.create/i)).toBeInTheDocument();
|
|
147
140
|
});
|
|
148
141
|
});
|