@truedat/bg 7.0.4 → 7.0.6

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 (99) hide show
  1. package/package.json +6 -6
  2. package/src/concepts/components/DomainConcepts.js +1 -4
  3. package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +2 -2
  4. package/src/concepts/components/__tests__/__snapshots__/ConceptsBulkUpdate.spec.js.snap +2 -2
  5. package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +2 -2
  6. package/src/hooks/useDomains.js +77 -0
  7. package/src/messages/en.js +6 -0
  8. package/src/messages/es.js +5 -0
  9. package/src/reducers/index.js +0 -1
  10. package/src/taxonomy/components/AddDomainMember.js +1 -7
  11. package/src/taxonomy/components/Domain.js +80 -84
  12. package/src/taxonomy/components/DomainActions.js +57 -84
  13. package/src/taxonomy/components/DomainCrumbs.js +51 -43
  14. package/src/taxonomy/components/DomainDetail.js +88 -46
  15. package/src/taxonomy/components/DomainForm.js +34 -36
  16. package/src/taxonomy/components/DomainImplementations.js +1 -4
  17. package/src/taxonomy/components/DomainMembers.js +8 -1
  18. package/src/taxonomy/components/DomainRoutes.js +8 -55
  19. package/src/taxonomy/components/DomainStructures.js +1 -4
  20. package/src/taxonomy/components/DomainTabs.js +22 -29
  21. package/src/taxonomy/components/Domains.js +66 -27
  22. package/src/taxonomy/components/DomainsActions.js +5 -14
  23. package/src/taxonomy/components/EditDomain.js +35 -21
  24. package/src/taxonomy/components/NewDomain.js +47 -22
  25. package/src/taxonomy/components/__tests__/Domain.spec.js +17 -8
  26. package/src/taxonomy/components/__tests__/DomainActions.spec.js +62 -7
  27. package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +18 -5
  28. package/src/taxonomy/components/__tests__/DomainDetail.spec.js +87 -4
  29. package/src/taxonomy/components/__tests__/DomainForm.spec.js +189 -4
  30. package/src/taxonomy/components/__tests__/DomainMembers.spec.js +1 -3
  31. package/src/taxonomy/components/__tests__/DomainStructures.spec.js +3 -2
  32. package/src/taxonomy/components/__tests__/Domains.spec.js +103 -6
  33. package/src/taxonomy/components/__tests__/EditDomain.spec.js +56 -5
  34. package/src/taxonomy/components/__tests__/NewDomain.spec.js +65 -6
  35. package/src/taxonomy/components/__tests__/__snapshots__/AddDomainMember.spec.js.snap +0 -10
  36. package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +35 -48
  37. package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +56 -1
  38. package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +14 -2
  39. package/src/taxonomy/components/__tests__/__snapshots__/DomainDetail.spec.js.snap +93 -40
  40. package/src/taxonomy/components/__tests__/__snapshots__/DomainForm.spec.js.snap +7 -7
  41. package/src/taxonomy/components/__tests__/__snapshots__/Domains.spec.js.snap +75 -10
  42. package/src/taxonomy/components/__tests__/__snapshots__/DomainsActions.spec.js.snap +20 -1
  43. package/src/taxonomy/components/__tests__/__snapshots__/EditDomain.spec.js.snap +192 -30
  44. package/src/taxonomy/components/__tests__/__snapshots__/NewDomain.spec.js.snap +405 -28
  45. package/src/taxonomy/components/index.js +1 -2
  46. package/src/taxonomy/index.js +0 -1
  47. package/src/taxonomy/routines.js +0 -10
  48. package/src/taxonomy/sagas/index.js +2 -21
  49. package/src/taxonomy/selectors/getDomainsConcept.js +0 -13
  50. package/src/taxonomy/selectors/index.js +0 -16
  51. package/src/taxonomy/components/DomainCards.js +0 -97
  52. package/src/taxonomy/components/DomainLoader.js +0 -60
  53. package/src/taxonomy/components/DomainMembersLoader.js +0 -44
  54. package/src/taxonomy/components/DomainsLoader.js +0 -40
  55. package/src/taxonomy/components/__tests__/DomainCards.spec.js +0 -30
  56. package/src/taxonomy/components/__tests__/DomainsLoader.spec.js +0 -38
  57. package/src/taxonomy/components/__tests__/__snapshots__/DomainCards.spec.js.snap +0 -160
  58. package/src/taxonomy/reducers/__tests__/domain.spec.js +0 -58
  59. package/src/taxonomy/reducers/__tests__/domainConceptLoading.spec.js +0 -26
  60. package/src/taxonomy/reducers/__tests__/domainCreating.spec.js +0 -24
  61. package/src/taxonomy/reducers/__tests__/domainLoading.spec.js +0 -22
  62. package/src/taxonomy/reducers/__tests__/domainMembersActions.spec.js +0 -38
  63. package/src/taxonomy/reducers/__tests__/domainMembersLoading.spec.js +0 -26
  64. package/src/taxonomy/reducers/__tests__/domainRedirect.spec.js +0 -36
  65. package/src/taxonomy/reducers/__tests__/domainUpdating.spec.js +0 -24
  66. package/src/taxonomy/reducers/__tests__/domains.spec.js +0 -30
  67. package/src/taxonomy/reducers/__tests__/domainsActions.spec.js +0 -36
  68. package/src/taxonomy/reducers/__tests__/domainsConcept.spec.js +0 -30
  69. package/src/taxonomy/reducers/__tests__/domainsFilter.spec.js +0 -41
  70. package/src/taxonomy/reducers/__tests__/domainsLoading.spec.js +0 -22
  71. package/src/taxonomy/reducers/domain.js +0 -32
  72. package/src/taxonomy/reducers/domainActions.js +0 -19
  73. package/src/taxonomy/reducers/domainCreating.js +0 -14
  74. package/src/taxonomy/reducers/domainLoading.js +0 -14
  75. package/src/taxonomy/reducers/domainMembersActions.js +0 -22
  76. package/src/taxonomy/reducers/domainMembersLoading.js +0 -12
  77. package/src/taxonomy/reducers/domainRedirect.js +0 -25
  78. package/src/taxonomy/reducers/domainUpdating.js +0 -14
  79. package/src/taxonomy/reducers/domains.js +0 -19
  80. package/src/taxonomy/reducers/domainsActions.js +0 -20
  81. package/src/taxonomy/reducers/domainsConcept.js +0 -19
  82. package/src/taxonomy/reducers/domainsConceptLoading.js +0 -12
  83. package/src/taxonomy/reducers/domainsFilter.js +0 -24
  84. package/src/taxonomy/reducers/domainsLoading.js +0 -12
  85. package/src/taxonomy/reducers/index.js +0 -31
  86. package/src/taxonomy/sagas/__tests__/fetchDomain.spec.js +0 -69
  87. package/src/taxonomy/sagas/__tests__/fetchDomains.spec.js +0 -90
  88. package/src/taxonomy/sagas/createDomain.js +0 -27
  89. package/src/taxonomy/sagas/deleteDomain.js +0 -34
  90. package/src/taxonomy/sagas/fetchDomain.js +0 -30
  91. package/src/taxonomy/sagas/fetchDomains.js +0 -37
  92. package/src/taxonomy/sagas/updateDomain.js +0 -30
  93. package/src/taxonomy/selectors/__tests__/domainParentOptionsSelector.spec.js +0 -24
  94. package/src/taxonomy/selectors/__tests__/getDomainActions.spec.js +0 -46
  95. package/src/taxonomy/selectors/__tests__/getDomainGroups.spec.js +0 -17
  96. package/src/taxonomy/selectors/__tests__/getDomainTypes.spec.js +0 -14
  97. package/src/taxonomy/selectors/domainParentOptionsSelector.js +0 -12
  98. package/src/taxonomy/selectors/getDomainActions.js +0 -32
  99. package/src/taxonomy/selectors/getDomainGroups.js +0 -11
@@ -1,7 +1,112 @@
1
1
  import React from "react";
2
2
  import userEvent from "@testing-library/user-event";
3
+ import { fireEvent } from "@testing-library/react";
4
+ import { waitFor } from "@testing-library/react";
3
5
  import { render } from "@truedat/test/render";
4
6
  import { DomainForm } from "../DomainForm";
7
+ import { useDomains } from "../../../hooks/useDomains";
8
+
9
+ jest.mock("../../../hooks/useDomains", () => ({
10
+ ...jest.requireActual("../../../hooks/useDomains"),
11
+ useDomains: jest.fn(() => ({
12
+ data: [
13
+ {
14
+ description: "No tiene padre",
15
+ domain_group: null,
16
+ external_id: "1",
17
+ id: 1,
18
+ name: "domain_1",
19
+ parent_id: null,
20
+ parents: null,
21
+ type: null,
22
+ },
23
+ {
24
+ description: "No tiene padre",
25
+ domain_group: null,
26
+ external_id: "2",
27
+ id: 2,
28
+ name: "domain_2",
29
+ parent_id: null,
30
+ parents: null,
31
+ type: null,
32
+ },
33
+ {
34
+ description: "el padre es domain_2",
35
+ domain_group: null,
36
+ external_id: "3",
37
+ id: 3,
38
+ name: "domain_3",
39
+ parent_id: 2,
40
+ parents: null,
41
+ type: null,
42
+ },
43
+ {
44
+ description: "el padre es domain_2",
45
+ domain_group: null,
46
+ external_id: "4",
47
+ id: 4,
48
+ name: "domain_4",
49
+ parent_id: 2,
50
+ parents: null,
51
+ type: null,
52
+ },
53
+ {
54
+ description: "No tiene padre",
55
+ domain_group: null,
56
+ external_id: "5",
57
+ id: 5,
58
+ name: "domain_5",
59
+ parent_id: null,
60
+ parents: null,
61
+ type: null,
62
+ },
63
+ {
64
+ description: "el padre es domain_5",
65
+ domain_group: null,
66
+ external_id: "6",
67
+ id: 6,
68
+ name: "domain_6",
69
+ parent_id: 5,
70
+ parents: null,
71
+ type: null,
72
+ },
73
+ {
74
+ description: "el padre es domain_6",
75
+ domain_group: null,
76
+ external_id: "7",
77
+ id: 7,
78
+ name: "domain_7",
79
+ parent_id: 6,
80
+ parents: null,
81
+ type: null,
82
+ },
83
+ ],
84
+ })),
85
+ }));
86
+
87
+ const renderOpts = {
88
+ messages: {
89
+ en: {
90
+ "domain.label.domain_group": "New Group ",
91
+ "form.validation.required": "Prop is required",
92
+ "domain.props.parent": "Parent Domain",
93
+ "domain.selector.placeholder": "Select a domain...",
94
+ "domain.props.name": "Name",
95
+ "domain.props.name.placeholder": "Name-placeholder",
96
+ "domain.props.external_id": "External_id",
97
+ "domain.props.external_id.placeholder": "External_id-placeholder",
98
+ "domain.props.domain_group": "Domain_group",
99
+ "domain.props.domain_group.placeholder": "Domain_group-placeholder",
100
+ "domain.props.type": "Type",
101
+ "domain.props.type.placeholder": "Type-placeholder",
102
+ "domain.props.description.placeholder": "Description-placeholder",
103
+ "domain.props.description": "Description",
104
+ "actions.save": "Save",
105
+ "actions.cancel": "Cancel",
106
+ },
107
+ },
108
+ fallback: "lazy",
109
+ };
5
110
 
6
111
  describe("<DomainForm />", () => {
7
112
  const onSubmit = jest.fn();
@@ -10,17 +115,97 @@ describe("<DomainForm />", () => {
10
115
  const props = { domain, onSubmit, isSubmitting };
11
116
 
12
117
  it("matches the latest snapshot", async () => {
13
- const { container, findByRole } = render(<DomainForm {...props} />);
14
- await findByRole("button", { name: "Save" });
118
+ const { container, queryByText } = render(
119
+ <DomainForm {...props} />,
120
+ renderOpts
121
+ );
122
+ await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
15
123
  expect(container).toMatchSnapshot();
16
124
  });
17
125
 
18
126
  it("enables submit when required fields have values", async () => {
19
127
  const props = { domain: {}, onSubmit: jest.fn() };
20
- const { findByRole } = render(<DomainForm {...props} />);
128
+ const { findByRole } = render(<DomainForm {...props} />, renderOpts);
129
+
21
130
  expect(await findByRole("button", { name: "Save" })).toBeDisabled();
131
+
22
132
  userEvent.type(await findByRole("textbox", { name: "Name" }), "name");
23
- userEvent.type(await findByRole("textbox", { name: "External Id" }), "id");
133
+ userEvent.type(await findByRole("textbox", { name: "External_id" }), "id");
134
+
24
135
  expect(await findByRole("button", { name: "Save" })).toBeEnabled();
25
136
  });
137
+
138
+ it("should generate unique domain group options", () => {
139
+ useDomains.mockImplementationOnce(() => ({
140
+ data: [
141
+ { domain_group: { name: "DomainGroup1" } },
142
+ { domain_group: { name: "DomainGroup2" } },
143
+ { domain_group: { name: "DomainGroup3" } },
144
+ { domain_group: null },
145
+ { domain_group: { name: "DomainGroup2" } },
146
+ { domain_group: { name: "DomainGroup3" } },
147
+ { domain_group: null },
148
+ ],
149
+ }));
150
+
151
+ const { getByText, getAllByRole } = render(
152
+ <DomainForm onSubmit={jest.fn()} />,
153
+ renderOpts
154
+ );
155
+
156
+ const domainGroupPlaceholder = getByText("Domain_group-placeholder");
157
+
158
+ fireEvent.click(domainGroupPlaceholder);
159
+
160
+ const options = getAllByRole("option").map((option) => option.textContent);
161
+
162
+ expect(options).toMatchObject([
163
+ "DomainGroup1",
164
+ "DomainGroup2",
165
+ "DomainGroup3",
166
+ "",
167
+ ]);
168
+ });
169
+
170
+ it("should generate unique type options", async () => {
171
+ useDomains.mockImplementationOnce(() => ({
172
+ data: [
173
+ { type: "Type1" },
174
+ { type: "Type2" },
175
+ { type: null },
176
+ { type: "Type3" },
177
+ { type: "Type1" },
178
+ { type: "Type4" },
179
+ { type: null },
180
+ ],
181
+ }));
182
+
183
+ const { getAllByRole } = render(
184
+ <DomainForm onSubmit={jest.fn()} />,
185
+ renderOpts
186
+ );
187
+
188
+ const options = getAllByRole("option").map((option) => option.textContent);
189
+
190
+ expect(options).toMatchObject(["", "Type1", "Type2", "Type3", "Type4"]);
191
+ });
192
+
193
+ it("should generate domain parent options", async () => {
194
+ const domain = { id: 2, parentable_ids: [1, 5, 6, 7] };
195
+
196
+ const { getAllByRole } = render(
197
+ <DomainForm domain={domain} onSubmit={jest.fn()} />,
198
+ renderOpts
199
+ );
200
+
201
+ const options = getAllByRole("option").map((option) => option.textContent);
202
+
203
+ expect(options).toMatchObject([
204
+ "domain_1",
205
+ "domain_5",
206
+ "domain_6",
207
+ "domain_7",
208
+ "",
209
+ ]);
210
+ });
26
211
  });
@@ -12,9 +12,7 @@ jest.mock("react-router-dom", () => ({
12
12
  }));
13
13
 
14
14
  describe("<DomainMembers />", () => {
15
- const props = {
16
- type: "domain",
17
- };
15
+ const props = { domainId: 1 };
18
16
 
19
17
  it("matches the latest snapshot", () => {
20
18
  const { container } = render(<DomainMembers {...props} />);
@@ -68,13 +68,14 @@ describe("<DomainStructures />", () => {
68
68
  "No structures have been found matching these filters.",
69
69
  },
70
70
  },
71
- state: { domain: { id: 1, name: "domain" } },
71
+ fallback: "lazy",
72
72
  };
73
73
 
74
74
  it("matches the latest snapshot", async () => {
75
+ const props = { domain: { id: 1, name: "domain" } };
75
76
  const { container, findByText } = render(
76
77
  <SearchContextWrapper>
77
- <DomainStructures />
78
+ <DomainStructures {...props} />
78
79
  </SearchContextWrapper>,
79
80
  renderOpts
80
81
  );
@@ -1,14 +1,111 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import { Domains } from "../Domains";
3
+ import Domains from "../Domains";
4
4
 
5
- describe("<Domains />", () => {
6
- const createDomain = jest.fn();
7
- const domainsLoading = false;
8
- const props = { createDomain, domainsLoading };
5
+ jest.mock("react-router-dom", () => ({
6
+ ...jest.requireActual("react-router-dom"),
7
+ useHistory: jest.fn(),
8
+ useParams: jest.fn(() => ({ id: 3 })),
9
+ }));
10
+
11
+ jest.mock("../../../hooks/useDomains", () => ({
12
+ ...jest.requireActual("../../../hooks/useDomains"),
13
+ useDomains: jest.fn(() => ({
14
+ data: [
15
+ {
16
+ description: "No tiene padre",
17
+ domain_group: null,
18
+ external_id: "1",
19
+ id: 1,
20
+ name: "element_1",
21
+ parent_id: null,
22
+ parents: null,
23
+ type: null,
24
+ },
25
+ {
26
+ description: "No tiene padre",
27
+ domain_group: null,
28
+ external_id: "2",
29
+ id: 2,
30
+ name: "element_2",
31
+ parent_id: null,
32
+ parents: null,
33
+ type: null,
34
+ },
35
+ {
36
+ description: "el padre es element_2",
37
+ domain_group: null,
38
+ external_id: "3",
39
+ id: 3,
40
+ name: "element_3",
41
+ parent_id: 2,
42
+ parents: null,
43
+ type: null,
44
+ },
45
+ {
46
+ description: "el padre es element_2",
47
+ domain_group: null,
48
+ external_id: "4",
49
+ id: 4,
50
+ name: "element_4",
51
+ parent_id: 2,
52
+ parents: null,
53
+ type: null,
54
+ },
55
+ {
56
+ description: "No tiene padre",
57
+ domain_group: null,
58
+ external_id: "5",
59
+ id: 5,
60
+ name: "element_5",
61
+ parent_id: null,
62
+ parents: null,
63
+ type: null,
64
+ },
65
+ {
66
+ description: "el padre es element_5",
67
+ domain_group: null,
68
+ external_id: "6",
69
+ id: 6,
70
+ name: "element_6",
71
+ parent_id: 5,
72
+ parents: null,
73
+ type: null,
74
+ },
75
+ {
76
+ description: "el padre es element_6",
77
+ domain_group: null,
78
+ external_id: "7",
79
+ id: 7,
80
+ name: "element_7",
81
+ parent_id: 6,
82
+ parents: null,
83
+ type: null,
84
+ },
85
+ ],
86
+ actions: {
87
+ create: {
88
+ href: "/api/domains",
89
+ input: {},
90
+ method: "POST",
91
+ },
92
+ update: {
93
+ href: "/api/domains/:id",
94
+ input: {},
95
+ method: "PATCH",
96
+ },
97
+ index: {
98
+ href: "/api/domains",
99
+ input: {},
100
+ method: "GET",
101
+ },
102
+ },
103
+ })),
104
+ }));
9
105
 
106
+ describe("<Domains />", () => {
10
107
  it("matches the latest snapshot", () => {
11
- const { container } = render(<Domains {...props} />);
108
+ const { container } = render(<Domains />);
12
109
  expect(container).toMatchSnapshot();
13
110
  });
14
111
  });
@@ -1,14 +1,65 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
2
+ import { useHistory } from "react-router-dom";
3
+ import { useQuery } from "@apollo/client";
4
+ import { render } from "@truedat/test/render";
5
+ import { useDomainUpdate } from "../../../hooks/useDomains";
3
6
  import { EditDomain } from "../EditDomain";
4
7
 
8
+ jest.mock("react-router-dom", () => ({
9
+ ...jest.requireActual("react-router-dom"),
10
+ useHistory: jest.fn(),
11
+ }));
12
+
13
+ jest.mock("../../../hooks/useDomains", () => ({
14
+ ...jest.requireActual("../../../hooks/useDomains"),
15
+ useDomainUpdate: jest.fn(),
16
+ }));
17
+
18
+ jest.mock("@apollo/client", () => ({
19
+ ...jest.requireActual("@apollo/client"),
20
+ useQuery: jest.fn(),
21
+ }));
22
+
23
+ const renderOpts = {
24
+ messages: {
25
+ en: {
26
+ "actions.save": "Save",
27
+ "actions.cancel": "Cancel",
28
+ "domain.actions.edit.header": "Edit domain",
29
+ "domain.label.domain_group": "New Group ",
30
+ "domain.props.name": "Name",
31
+ "domain.props.name.placeholder": "Name-placeholder",
32
+ "domain.props.external_id": "External_id",
33
+ "domain.props.external_id.placeholder": "External_id-placeholder",
34
+ "domain.props.domain_group": "Domain_group",
35
+ "domain.props.domain_group.placeholder": "Domain_group-placeholder",
36
+ "domain.props.type": "Type",
37
+ "domain.props.type.placeholder": "Type-placeholder",
38
+ "domain.props.description.placeholder": "Description-placeholder",
39
+ "domain.props.description": "Description",
40
+ "form.validation.required": "{prop} is required",
41
+ },
42
+ },
43
+ fallback: "lazy",
44
+ };
45
+
5
46
  describe("<EditDomain />", () => {
6
- const updateDomain = jest.fn();
47
+ const mockHistoryPush = jest.fn();
48
+ const mockCreateDomain = jest.fn();
49
+ const mockClientResetStore = jest.fn();
50
+
7
51
  const domain = { id: 1, name: "nn", description: "dd" };
8
- const props = { domain, updateDomain };
52
+
53
+ beforeEach(() => {
54
+ useHistory.mockReturnValue({ push: mockHistoryPush });
55
+ useDomainUpdate.mockReturnValue({ trigger: mockCreateDomain });
56
+ useQuery.mockReturnValue({
57
+ client: { resetStore: mockClientResetStore },
58
+ });
59
+ });
9
60
 
10
61
  it("matches the latest snapshot", () => {
11
- const wrapper = shallow(<EditDomain {...props} />);
12
- expect(wrapper).toMatchSnapshot();
62
+ const { container } = render(<EditDomain domain={domain} />, renderOpts);
63
+ expect(container).toMatchSnapshot();
13
64
  });
14
65
  });
@@ -1,14 +1,73 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
2
+ import { useHistory } from "react-router-dom";
3
+ import { useQuery } from "@apollo/client";
4
+ import { render } from "@truedat/test/render";
5
+ import { useDomainCreate } from "../../../hooks/useDomains";
3
6
  import { NewDomain } from "../NewDomain";
4
7
 
8
+ jest.mock("react-router-dom", () => ({
9
+ ...jest.requireActual("react-router-dom"),
10
+ useHistory: jest.fn(),
11
+ }));
12
+
13
+ jest.mock("../../../hooks/useDomains", () => ({
14
+ ...jest.requireActual("../../../hooks/useDomains"),
15
+ useDomainCreate: jest.fn(),
16
+ }));
17
+
18
+ jest.mock("@apollo/client", () => ({
19
+ ...jest.requireActual("@apollo/client"),
20
+ useQuery: jest.fn(),
21
+ }));
22
+
23
+ const renderOpts = {
24
+ messages: {
25
+ en: {
26
+ "domains.actions.create": "New domain",
27
+ "domain.actions.create": "New subdomain",
28
+ "domain.props.name": "Name",
29
+ "domain.props.name.placeholder": "Name-placeholder",
30
+ "domain.props.external_id": "External_id",
31
+ "domain.props.external_id.placeholder": "External_id-placeholder",
32
+ "domain.props.domain_group": "Domain_group",
33
+ "domain.props.domain_group.placeholder": "Domain_group-placeholder",
34
+ "domain.props.type": "Type",
35
+ "domain.props.type.placeholder": "Type-placeholder",
36
+ "domain.props.description.placeholder": "Description-placeholder",
37
+ "domain.props.description": "Description",
38
+ "actions.save": "Save",
39
+ "actions.cancel": "Cancel",
40
+ "domain.label.domain_group": "New Group ",
41
+ "domain.props.external_id": "External Id",
42
+ "form.validation.required": "{prop} is required",
43
+ "navigation.glossary.taxonomy": "Taxonomy",
44
+ },
45
+ },
46
+ fallback: "lazy",
47
+ };
48
+
5
49
  describe("<NewDomain />", () => {
6
- const createDomain = jest.fn();
50
+ const mockHistoryPush = jest.fn();
51
+ const mockCreateDomain = jest.fn();
52
+ const mockClientResetStore = jest.fn();
53
+
7
54
  const domain = { id: 1, name: "nn", description: "dd" };
8
- const props = { domain, createDomain };
9
55
 
10
- it("matches the latest snapshot", () => {
11
- const wrapper = shallow(<NewDomain {...props} />);
12
- expect(wrapper).toMatchSnapshot();
56
+ beforeEach(() => {
57
+ useHistory.mockReturnValue({ push: mockHistoryPush });
58
+ useDomainCreate.mockReturnValue({ trigger: mockCreateDomain });
59
+ useQuery.mockReturnValue({
60
+ client: { resetStore: mockClientResetStore },
61
+ });
62
+ });
63
+
64
+ it("matches the latest snapshot main domain", () => {
65
+ const { container } = render(<NewDomain domain={null} />, renderOpts);
66
+ expect(container).toMatchSnapshot();
67
+ });
68
+
69
+ it("matches the latest snapshot subdomain", () => {
70
+ const { container } = render(<NewDomain domain={domain} />, renderOpts);
71
+ expect(container).toMatchSnapshot();
13
72
  });
14
73
  });
@@ -2,16 +2,6 @@
2
2
 
3
3
  exports[`<AddDomainMember /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <div
6
- class="ui breadcrumb"
7
- >
8
- <a
9
- class="active section"
10
- href="/domains"
11
- >
12
- Taxonomy
13
- </a>
14
- </div>
15
5
  <div
16
6
  class="ui segment ui text container"
17
7
  >
@@ -2,25 +2,6 @@
2
2
 
3
3
  exports[`<Domain /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <div
6
- class="ui breadcrumb"
7
- >
8
- <a
9
- class="section"
10
- href="/domains"
11
- >
12
- Taxonomy
13
- </a>
14
- <i
15
- aria-hidden="true"
16
- class="right angle icon divider"
17
- />
18
- <div
19
- class="active section"
20
- >
21
- DOMAIN NAME
22
- </div>
23
- </div>
24
5
  <div
25
6
  class="ui segment"
26
7
  >
@@ -28,47 +9,47 @@ exports[`<Domain /> matches the latest snapshot 1`] = `
28
9
  class="ui grid"
29
10
  >
30
11
  <div
31
- class="eight wide column"
12
+ class="row"
32
13
  >
33
- <h2
34
- class="ui header"
14
+ <div
15
+ class="eight wide column"
35
16
  >
36
- <i
37
- aria-hidden="true"
38
- class="cube icon"
39
- />
40
- <div
41
- class="content"
17
+ <h2
18
+ class="ui header"
42
19
  >
43
- DOMAIN NAME
20
+ <i
21
+ aria-hidden="true"
22
+ class="cube icon"
23
+ />
44
24
  <div
45
- class="sub header"
25
+ class="content"
46
26
  >
47
- Domain
27
+ DOMAIN NAME
28
+ <div
29
+ class="sub header"
30
+ >
31
+ Domain
32
+ </div>
48
33
  </div>
49
- </div>
50
- </h2>
34
+ </h2>
35
+ </div>
36
+ <div
37
+ class="right aligned eight wide column"
38
+ />
51
39
  </div>
52
40
  <div
53
- class="right aligned eight wide column"
54
- />
41
+ class="row"
42
+ >
43
+ <div
44
+ class="column"
45
+ >
46
+ DOMAIN DESCRIPTION
47
+ </div>
48
+ </div>
55
49
  </div>
56
- <p />
57
50
  <div
58
51
  class="ui pointing secondary top attached tabular menu"
59
52
  >
60
- <a
61
- class="active item"
62
- href="/domains/3"
63
- >
64
- Subdomains
65
- </a>
66
- <a
67
- class="item"
68
- href="/domains/3/members"
69
- >
70
- Members
71
- </a>
72
53
  <a
73
54
  class="item"
74
55
  href="/domains/3/concepts"
@@ -87,6 +68,12 @@ exports[`<Domain /> matches the latest snapshot 1`] = `
87
68
  >
88
69
  Data Quality
89
70
  </a>
71
+ <a
72
+ class="item"
73
+ href="/domains/3/members"
74
+ >
75
+ Members
76
+ </a>
90
77
  </div>
91
78
  <div
92
79
  class="ui bottom attached segment"