@truedat/lm 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.
Files changed (73) hide show
  1. package/index.js +5 -0
  2. package/package.json +43 -67
  3. package/src/components/ConceptImplementationLink.js +1 -2
  4. package/src/components/ConceptLink.js +2 -3
  5. package/src/components/ConceptLinkTags.js +0 -1
  6. package/src/components/ConceptStructureLinkForm.js +3 -3
  7. package/src/components/ConfirmDeleteRelation.js +0 -1
  8. package/src/components/ImplementationLinkRow.js +0 -1
  9. package/src/components/ImplementationLinks.js +1 -2
  10. package/src/components/ImplementationRelationForm.js +5 -8
  11. package/src/components/LinksPane.js +0 -1
  12. package/src/components/NewRelationTag.js +0 -1
  13. package/src/components/RelationActions.js +3 -4
  14. package/src/components/RelationGraph.js +17 -104
  15. package/src/components/RelationGraphDepth.js +0 -1
  16. package/src/components/RelationRoutes.js +16 -25
  17. package/src/components/RelationRow.js +6 -7
  18. package/src/components/RelationTagCards.js +3 -4
  19. package/src/components/RelationTagForm.js +0 -2
  20. package/src/components/RelationTags.js +1 -2
  21. package/src/components/RelationTagsLoader.js +2 -2
  22. package/src/components/Relations.js +0 -1
  23. package/src/components/RelationsGraphLoader.js +0 -1
  24. package/src/components/StructureLinkRow.js +0 -1
  25. package/src/components/StructureLinks.js +1 -2
  26. package/src/components/StructureRelationForm.js +5 -9
  27. package/src/components/TagTypeDropdownSelector.js +1 -1
  28. package/src/components/TagTypeSelector.js +0 -2
  29. package/src/components/__tests__/ConceptImplementationLink.spec.js +0 -1
  30. package/src/components/__tests__/ConceptLinkTags.spec.js +7 -9
  31. package/src/components/__tests__/ConceptStructureLinkForm.spec.js +68 -20
  32. package/src/components/__tests__/ConfirmDeleteRelation.spec.js +0 -1
  33. package/src/components/__tests__/ImplementationLinkRow.spec.js +0 -1
  34. package/src/components/__tests__/ImplementationLinks.spec.js +0 -1
  35. package/src/components/__tests__/ImplementationRelationForm.spec.js +45 -73
  36. package/src/components/__tests__/LinksPane.spec.js +0 -1
  37. package/src/components/__tests__/NewRelationTag.spec.js +0 -1
  38. package/src/components/__tests__/RelationActions.spec.js +14 -15
  39. package/src/components/__tests__/RelationRoutes.spec.js +59 -7
  40. package/src/components/__tests__/RelationRow.spec.js +46 -23
  41. package/src/components/__tests__/RelationTagCards.spec.js +0 -1
  42. package/src/components/__tests__/RelationTagForm.spec.js +26 -37
  43. package/src/components/__tests__/RelationTags.spec.js +0 -1
  44. package/src/components/__tests__/RelationTagsLoader.spec.js +6 -6
  45. package/src/components/__tests__/Relations.spec.js +19 -17
  46. package/src/components/__tests__/RelationsGraphLoader.spec.js +32 -26
  47. package/src/components/__tests__/RelationsLoader.spec.js +19 -19
  48. package/src/components/__tests__/StructureRelationForm.spec.js +41 -42
  49. package/src/components/__tests__/TagTypeSelector.spec.js +7 -13
  50. package/src/components/__tests__/__snapshots__/ConceptImplementationLink.spec.js.snap +1 -0
  51. package/src/components/__tests__/__snapshots__/ConceptLinkTags.spec.js.snap +12 -20
  52. package/src/components/__tests__/__snapshots__/ConceptStructureLinkForm.spec.js.snap +170 -19
  53. package/src/components/__tests__/__snapshots__/ImplementationLinks.spec.js.snap +4 -0
  54. package/src/components/__tests__/__snapshots__/ImplementationRelationForm.spec.js.snap +13 -13
  55. package/src/components/__tests__/__snapshots__/NewRelationTag.spec.js.snap +12 -11
  56. package/src/components/__tests__/__snapshots__/RelationActions.spec.js.snap +1 -1
  57. package/src/components/__tests__/__snapshots__/RelationRoutes.spec.js.snap +21 -5
  58. package/src/components/__tests__/__snapshots__/RelationRow.spec.js.snap +7 -1
  59. package/src/components/__tests__/__snapshots__/RelationTagCards.spec.js.snap +0 -1
  60. package/src/components/__tests__/__snapshots__/RelationTagForm.spec.js.snap +11 -10
  61. package/src/components/__tests__/__snapshots__/RelationTags.spec.js.snap +1 -1
  62. package/src/components/__tests__/__snapshots__/RelationTagsLoader.spec.js.snap +1 -1
  63. package/src/components/__tests__/__snapshots__/Relations.spec.js.snap +36 -27
  64. package/src/components/__tests__/__snapshots__/RelationsGraphLoader.spec.js.snap +1 -25
  65. package/src/components/__tests__/__snapshots__/StructureRelationForm.spec.js.snap +1 -1
  66. package/src/components/__tests__/__snapshots__/TagTypeSelector.spec.js.snap +11 -14
  67. package/src/hooks/useTags.js +1 -1
  68. package/src/sagas/__tests__/fetchRelationsGraph.spec.js +2 -2
  69. package/src/sagas/deleteRelation.js +1 -1
  70. package/src/sagas/fetchRelationsGraph.js +1 -1
  71. package/src/sagas/updateRelationTag.js +1 -1
  72. package/src/selectors/getStructureLinks.js +1 -1
  73. package/src/services/relationGraphTraversal.js +3 -3
@@ -1,68 +1,57 @@
1
- import React from "react";
2
- import { waitFor } from "@testing-library/react";
3
1
  import userEvent from "@testing-library/user-event";
4
- import { render } from "@truedat/test/render";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { render, waitForLoad } from "@truedat/test/render";
5
4
  import { RelationTagForm } from "../RelationTagForm";
6
5
 
7
- const renderOpts = {
8
- messages: {
9
- en: {
10
- "actions.cancel": "cancel",
11
- "actions.create": "create",
12
- "form.validation.required": "required",
13
- "relationTags.props.expandable": "Expandable",
14
- "relationTags.props.target_type": "target",
15
- "relationTags.props.target_type.placeholder": "...",
16
- "relationTags.props.type": "type",
17
- "relationTags.props.type.placeholder": "...",
18
- "target_type.business_concept": "concept",
19
- "target_type.data_field": "structure",
20
- "target_type.ingest": "ingest",
21
- "target_type.implementations": "implementations",
22
- },
23
- },
24
- };
25
-
26
6
  describe("<RelationTagForm />", () => {
27
7
  it("matches the latest snapshot", async () => {
28
- const { container, findByRole } = render(<RelationTagForm />, renderOpts);
29
- await findByRole("button", { name: /create/ });
30
- expect(container).toMatchSnapshot();
8
+ const rendered = render(<RelationTagForm />);
9
+ await waitForLoad(rendered);
10
+ await rendered.findByRole("button", { name: /create/i });
11
+ expect(rendered.container).toMatchSnapshot();
31
12
  });
32
13
 
33
14
  it("calls createRelationTag with on submit", async () => {
34
15
  const onSubmit = jest.fn();
16
+ const user = userEvent.setup({ delay: null });
35
17
 
36
- const { findByRole, getByRole, findByText } = render(
37
- <RelationTagForm onSubmit={(props) => onSubmit(props)} />,
38
- renderOpts
18
+ const rendered = render(
19
+ <RelationTagForm onSubmit={(props) => onSubmit(props)} />
39
20
  );
21
+ await waitForLoad(rendered);
40
22
 
41
23
  // Submit button should initially be disabled
42
24
  await waitFor(() =>
43
- expect(getByRole("button", { name: /create/ })).toBeDisabled()
25
+ expect(rendered.getByRole("button", { name: /create/i })).toBeDisabled()
44
26
  );
45
27
 
46
28
  // Input name
47
- userEvent.type(await findByRole("textbox", { name: "type" }), "foo");
29
+ await user.type(
30
+ await rendered.findByRole("textbox", { name: /type/i }),
31
+ "foo"
32
+ );
48
33
 
49
34
  // Select type
50
- userEvent.click(await findByText("target"));
51
- userEvent.click(await findByRole("option", { name: "concept" }));
35
+ await user.click(
36
+ await rendered.findByText("relationTags.props.target_type")
37
+ );
38
+ await user.click(await rendered.findByRole("option", { name: /concept/i }));
52
39
 
53
40
  //expandable
54
- const expandableCheckbox = await findByRole("checkbox", {
55
- name: /Expandable/,
41
+ const expandableCheckbox = await rendered.findByRole("checkbox", {
42
+ name: /expandable/i,
56
43
  });
57
- userEvent.click(expandableCheckbox);
44
+ await user.click(expandableCheckbox);
58
45
 
59
46
  // Submit button should now be enabled
60
47
  await waitFor(() =>
61
- expect(getByRole("button", { name: /create/ })).not.toBeDisabled()
48
+ expect(
49
+ rendered.getByRole("button", { name: /create/i })
50
+ ).not.toBeDisabled()
62
51
  );
63
52
 
64
53
  // Submit
65
- userEvent.click(await findByRole("button", { name: /create/ }));
54
+ await user.click(await rendered.findByRole("button", { name: /create/i }));
66
55
 
67
56
  await waitFor(() =>
68
57
  expect(onSubmit).toHaveBeenCalledWith({
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { render } from "@truedat/test/render";
3
2
  import RelationTags from "../RelationTags";
4
3
 
@@ -1,15 +1,15 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { RelationTagsLoader } from "../RelationTagsLoader";
4
3
 
5
4
  describe("<RelationTagsLoader />", () => {
6
- it("matches the latest snapshot", () => {
5
+ it("matches the latest snapshot", async () => {
7
6
  const props = {
8
7
  fetchRelationTags: jest.fn(),
9
8
  clearRelationTags: jest.fn(),
10
- relationTagsLoading: false
9
+ relationTagsLoading: false,
11
10
  };
12
- const wrapper = shallow(<RelationTagsLoader {...props} />);
13
- expect(wrapper).toMatchSnapshot();
11
+ const rendered = render(<RelationTagsLoader {...props} />);
12
+ await waitForLoad(rendered);
13
+ expect(rendered.container).toMatchSnapshot();
14
14
  });
15
15
  });
@@ -1,40 +1,42 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { Relations } from "../Relations";
4
3
 
5
4
  describe("<Relations />", () => {
6
5
  const defaultProps = {
7
6
  relationsLoading: false,
8
- relations: []
7
+ relations: [],
9
8
  };
10
- it("matches the latest snapshot", () => {
11
- const wrapper = shallow(<Relations {...defaultProps} />);
12
- expect(wrapper).toMatchSnapshot();
9
+ it("matches the latest snapshot", async () => {
10
+ const rendered = render(<Relations {...defaultProps} />);
11
+ await waitForLoad(rendered);
12
+ expect(rendered.container).toMatchSnapshot();
13
13
  });
14
14
 
15
- it("renders empty relations list message whe relations list is empty", () => {
16
- const wrapper = shallow(<Relations {...defaultProps} />);
17
- expect(wrapper.find({ id: "relations.empty" }).length).toBe(1);
15
+ it("renders empty relations list message whe relations list is empty", async () => {
16
+ const rendered = render(<Relations {...defaultProps} />);
17
+ await waitForLoad(rendered);
18
+ expect(rendered.getByText(/relations.empty/i)).toBeInTheDocument();
18
19
  });
19
20
 
20
- it("renders as many RelationRow as relations in list", () => {
21
- const wrapper = shallow(
21
+ it("renders as many RelationRow as relations in list", async () => {
22
+ const rendered = render(
22
23
  <Relations
23
24
  {...{
24
25
  ...defaultProps,
25
26
  relations: [
26
27
  {
27
- id: "1",
28
+ id: 1,
28
29
  name: "relation",
29
30
  context: {
30
31
  source: { name: "source name" },
31
- target: { name: "target name" }
32
- }
33
- }
34
- ]
32
+ target: { name: "target name" },
33
+ },
34
+ },
35
+ ],
35
36
  }}
36
37
  />
37
38
  );
38
- expect(wrapper.find({ id: "1", name: "relation" }).length).toBe(1);
39
+ await waitForLoad(rendered);
40
+ expect(rendered.container.querySelectorAll("tr").length).toBe(1);
39
41
  });
40
42
  });
@@ -1,63 +1,69 @@
1
- import React from "react";
2
- import { mount, shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { RelationsGraphLoader } from "../RelationsGraphLoader";
4
3
 
5
4
  describe("<RelationsGraphLoader />", () => {
6
5
  const resource_id = 1;
7
6
  const relationsGraphLoading = false;
8
7
 
9
- it("matches the latest snapshot", () => {
8
+ it("matches the latest snapshot", async () => {
10
9
  const props = {
11
10
  clearRelationsGraph: jest.fn(),
12
11
  fetchRelationsGraph: jest.fn(),
13
12
  relationsGraphLoading,
14
- resource_id
13
+ resource_id,
15
14
  };
16
- const wrapper = mount(<RelationsGraphLoader {...props} />);
17
- expect(wrapper).toMatchSnapshot();
15
+ const rendered = render(<RelationsGraphLoader {...props} />);
16
+ await waitForLoad(rendered);
17
+ expect(rendered.container).toMatchSnapshot();
18
18
  });
19
19
 
20
- it("renders a loader if relationsGraphLoading is true", () => {
20
+ it("renders a loader if relationsGraphLoading is true", async () => {
21
21
  const props = {
22
+ clearRelationsGraph: jest.fn(),
23
+ fetchRelationsGraph: jest.fn(),
22
24
  relationsGraphLoading: true,
23
- resource_id
25
+ resource_id,
24
26
  };
25
- const wrapper = shallow(<RelationsGraphLoader {...props} />);
26
- expect(wrapper.find("Loading").length).toBe(1);
27
+ const rendered = render(<RelationsGraphLoader {...props} />);
28
+ expect(rendered.container.querySelector(".loader")).toBeInTheDocument();
27
29
  });
28
30
 
29
- it("renders null if relationsGraphLoading is false", () => {
31
+ it("renders null if relationsGraphLoading is false", async () => {
30
32
  const props = {
33
+ clearRelationsGraph: jest.fn(),
34
+ fetchRelationsGraph: jest.fn(),
31
35
  relationsGraphLoading,
32
- resource_id
36
+ resource_id,
33
37
  };
34
- const wrapper = shallow(<RelationsGraphLoader {...props} />);
35
- expect(wrapper.getElement()).toBeNull();
38
+ const rendered = render(<RelationsGraphLoader {...props} />);
39
+ await waitForLoad(rendered);
40
+ expect(rendered.container.firstChild).toBeNull();
36
41
  });
37
42
 
38
- it("calls fetchRelationsGraph when component mounts but not when it unmounts", () => {
43
+ it("calls fetchRelationsGraph when component mounts but not when it unmounts", async () => {
39
44
  const props = {
40
45
  clearRelationsGraph: jest.fn(),
41
46
  fetchRelationsGraph: jest.fn(),
42
47
  relationsGraphLoading,
43
- resource_id
48
+ resource_id,
44
49
  };
45
- const wrapper = mount(<RelationsGraphLoader {...props} />);
46
- expect(props.fetchRelationsGraph.mock.calls.length).toBe(1);
47
- wrapper.unmount();
48
- expect(props.clearRelationsGraph.mock.calls.length).toBe(1);
50
+ const rendered = render(<RelationsGraphLoader {...props} />);
51
+ await waitForLoad(rendered);
52
+ expect(props.fetchRelationsGraph).toHaveBeenCalledTimes(1);
53
+ rendered.unmount();
54
+ expect(props.clearRelationsGraph).toHaveBeenCalledTimes(1);
49
55
  });
50
56
 
51
- it("calls clearRelationsGraph when component unmounts but not when it mounts", () => {
57
+ it("calls clearRelationsGraph when component unmounts but not when it mounts", async () => {
52
58
  const props = {
53
59
  clearRelationsGraph: jest.fn(),
54
60
  fetchRelationsGraph: jest.fn(),
55
61
  relationsGraphLoading: true,
56
- resource_id
62
+ resource_id,
57
63
  };
58
- const wrapper = mount(<RelationsGraphLoader {...props} />);
59
- expect(props.clearRelationsGraph.mock.calls.length).toBe(0);
60
- wrapper.unmount();
61
- expect(props.clearRelationsGraph.mock.calls.length).toBe(1);
64
+ const rendered = render(<RelationsGraphLoader {...props} />);
65
+ expect(props.clearRelationsGraph).not.toHaveBeenCalled();
66
+ rendered.unmount();
67
+ expect(props.clearRelationsGraph).toHaveBeenCalledTimes(1);
62
68
  });
63
69
  });
@@ -1,38 +1,38 @@
1
- import React from "react";
2
- import { mount } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { RelationsLoader } from "../RelationsLoader";
4
3
 
5
4
  describe("<RelationsLoader />", () => {
6
- it("calls fetchRelations on mount and clearRelations on unmount", () => {
5
+ it("calls fetchRelations on mount and clearRelations on unmount", async () => {
7
6
  const props = {
8
7
  clearRelations: jest.fn(),
9
8
  fetchRelations: jest.fn(),
10
9
  resource_id: 123,
11
10
  resource_type: "foo",
12
- target_type: "bar"
11
+ target_type: "bar",
13
12
  };
14
- const wrapper = mount(<RelationsLoader {...props} />);
15
- expect(props.clearRelations.mock.calls.length).toBe(0);
16
- expect(props.fetchRelations.mock.calls.length).toBe(1);
17
- wrapper.unmount();
18
- expect(props.fetchRelations.mock.calls.length).toBe(1);
19
- expect(props.clearRelations.mock.calls.length).toBe(1);
13
+ const rendered = render(<RelationsLoader {...props} />);
14
+ await waitForLoad(rendered);
15
+ expect(props.clearRelations).not.toHaveBeenCalled();
16
+ expect(props.fetchRelations).toHaveBeenCalledTimes(1);
17
+ rendered.unmount();
18
+ expect(props.fetchRelations).toHaveBeenCalledTimes(1);
19
+ expect(props.clearRelations).toHaveBeenCalledTimes(1);
20
20
  });
21
21
 
22
- it("calls fetchRelations when a prop changes", () => {
22
+ it("calls fetchRelations when a prop changes", async () => {
23
23
  const props = {
24
24
  clearRelations: jest.fn(),
25
25
  fetchRelations: jest.fn(),
26
26
  resource_id: 123,
27
27
  resource_type: "foo",
28
- target_type: "bar"
28
+ target_type: "bar",
29
29
  };
30
- const wrapper = mount(<RelationsLoader {...props} />);
31
- expect(props.fetchRelations.mock.calls.length).toBe(1);
32
- wrapper.setProps({
33
- ...props,
34
- target_type: "new target_type"
35
- });
36
- expect(props.fetchRelations.mock.calls.length).toBe(2);
30
+ const rendered = render(<RelationsLoader {...props} />);
31
+ await waitForLoad(rendered);
32
+ expect(props.fetchRelations).toHaveBeenCalledTimes(1);
33
+ rendered.rerender(
34
+ <RelationsLoader {...props} target_type="new target_type" />
35
+ );
36
+ expect(props.fetchRelations).toHaveBeenCalledTimes(2);
37
37
  });
38
38
  });
@@ -1,11 +1,12 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
3
- import { linkTo } from "@truedat/core/routes";
4
1
  import userEvent from "@testing-library/user-event";
5
2
  import { waitFor } from "@testing-library/react";
3
+ import { render, waitForLoad } from "@truedat/test/render";
4
+ import { linkTo } from "@truedat/core/routes";
6
5
  import { StructureRelationForm } from "../StructureRelationForm";
7
6
  import en from "../../messages/en";
8
7
 
8
+ jest.mock("@truedat/core/hooks/useUserFilters");
9
+
9
10
  const linkConcept = jest.fn();
10
11
 
11
12
  const data = {
@@ -115,31 +116,26 @@ const messages = {
115
116
  const renderOpts = {
116
117
  messages,
117
118
  state: { structure },
118
- fallback: "lazy",
119
119
  };
120
120
 
121
121
  describe("<StructureRelationForm />", () => {
122
122
  it("matches the latest snapshot", async () => {
123
- const { container, getByText } = render(
124
- <StructureRelationForm {...props} />,
125
- renderOpts
126
- );
123
+ const rendered = render(<StructureRelationForm {...props} />, renderOpts);
124
+ await waitForLoad(rendered);
127
125
 
128
- await waitFor(
129
- () => {
130
- expect(getByText(/relates_to/)).toBeInTheDocument();
131
- },
132
- { timeout: 60000 }
126
+ await waitFor(() =>
127
+ expect(rendered.getByText(/relates_to/i)).toBeInTheDocument()
133
128
  );
134
129
 
135
130
  await waitFor(() => {
136
- expect(container.querySelector(".loading")).toBeNull();
137
- });
138
- await waitFor(() => {
139
- expect(getByText(/foo concept/)).toBeInTheDocument();
131
+ expect(rendered.container.querySelector(".loading")).toBeNull();
140
132
  });
141
133
 
142
- expect(container).toMatchSnapshot();
134
+ await waitFor(() =>
135
+ expect(rendered.getByText(/foo concept/i)).toBeInTheDocument()
136
+ );
137
+
138
+ expect(rendered.container).toMatchSnapshot();
143
139
  });
144
140
 
145
141
  it("disables submit and shows loading state if concept is linking", async () => {
@@ -148,44 +144,47 @@ describe("<StructureRelationForm />", () => {
148
144
  conceptLinking: true,
149
145
  };
150
146
 
151
- const { queryByRole, getByText, findByRole, findByText } = render(
147
+ const rendered = render(
152
148
  <StructureRelationForm {...newProps} />,
153
149
  renderOpts
154
150
  );
155
151
 
156
- await waitFor(() => {
157
- expect(getByText(/relates_to/)).toBeInTheDocument();
158
- });
152
+ await waitFor(() =>
153
+ expect(rendered.getByText(/relates_to/i)).toBeInTheDocument()
154
+ );
159
155
 
160
- expect(queryByRole("button", { name: /Create/ })).toBeDisabled();
161
- userEvent.click(await findByText(/relates_to/));
162
- userEvent.click(await findByText(/bar concept/));
156
+ expect(rendered.queryByRole("button", { name: /create/i })).toBeDisabled();
163
157
 
164
- await waitFor(() => {
165
- expect(queryByRole("button", { name: /Create/ })).toBeEnabled();
166
- });
158
+ const user = userEvent.setup({ delay: null });
159
+ await user.click(await rendered.findByText(/relates_to/i));
160
+ await user.click(await rendered.findByText(/bar concept/i));
161
+
162
+ await waitFor(() =>
163
+ expect(rendered.queryByRole("button", { name: /create/i })).toBeEnabled()
164
+ );
167
165
 
168
- userEvent.click(await findByRole("button", { name: /Create/ }));
166
+ await user.click(await rendered.findByRole("button", { name: /create/i }));
169
167
 
170
- await waitFor(() => {
171
- expect(queryByRole("button", { name: /Create/ })).toHaveClass("loading");
172
- });
168
+ await waitFor(() =>
169
+ expect(rendered.queryByRole("button", { name: /create/i })).toHaveClass(
170
+ "loading"
171
+ )
172
+ );
173
173
  });
174
174
 
175
175
  it("submits the selected relation", async () => {
176
- const { getByText, findByRole, findByText } = render(
177
- <StructureRelationForm {...props} />,
178
- renderOpts
179
- );
176
+ const rendered = render(<StructureRelationForm {...props} />, renderOpts);
177
+ await waitForLoad(rendered);
180
178
 
181
- await waitFor(() => {
182
- expect(getByText(/relates_to/)).toBeInTheDocument();
183
- });
179
+ await waitFor(() =>
180
+ expect(rendered.getByText(/relates_to/i)).toBeInTheDocument()
181
+ );
184
182
 
185
- userEvent.click(await findByText(/relates_to/));
186
- userEvent.click(await findByText(/bar concept/));
183
+ const user = userEvent.setup({ delay: null });
184
+ await user.click(await rendered.findByText(/relates_to/i));
185
+ await user.click(await rendered.findByText(/bar concept/i));
187
186
 
188
- userEvent.click(await findByRole("button", { name: /Create/ }));
187
+ await user.click(await rendered.findByRole("button", { name: /create/i }));
189
188
 
190
189
  const expectedRelation = {
191
190
  redirectUrl: linkTo.STRUCTURE_LINKS({ id: 3 }),
@@ -1,20 +1,14 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
3
- import { intl } from "@truedat/test/intl-stub";
1
+ import { render, waitForLoad } from "@truedat/test/render";
4
2
  import { TagTypeSelector } from "../TagTypeSelector";
5
3
 
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
4
  describe("<TagTypeSelector />", () => {
11
- it("matches last snapshot", () => {
12
- const onChange = jest.fn();
13
- const defaultProps = {
5
+ it("matches the latest snapshot", async () => {
6
+ const props = {
14
7
  options: [],
15
- onChange
8
+ onChange: jest.fn(),
16
9
  };
17
- const wrapper = shallow(<TagTypeSelector {...defaultProps} />);
18
- expect(wrapper).toMatchSnapshot();
10
+ const rendered = render(<TagTypeSelector {...props} />);
11
+ await waitForLoad(rendered);
12
+ expect(rendered.container).toMatchSnapshot();
19
13
  });
20
14
  });
@@ -3,6 +3,7 @@
3
3
  exports[`<ConceptImplementationLink /> matches the latest snapshot 1`] = `
4
4
  <div>
5
5
  <a
6
+ data-discover="true"
6
7
  href="/concepts/8/versions/current/links/implementations"
7
8
  >
8
9
  ConceptImplementationLink
@@ -1,24 +1,16 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`ConceptLinkTags matches the latest snapshot 1`] = `
4
- <ul
5
- className="concept-link-tags"
6
- >
7
- <li
8
- key="0"
3
+ exports[`<ConceptLinkTags /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <ul
6
+ class="concept-link-tags"
9
7
  >
10
- <MemoizedFormattedMessage
11
- defaultMessage="otro tipo"
12
- id="conceptRelations.relationType.otro tipo"
13
- />
14
- </li>
15
- <li
16
- key="1"
17
- >
18
- <MemoizedFormattedMessage
19
- defaultMessage="business_concept_to_field_master"
20
- id="conceptRelations.relationType.business_concept_to_field_master"
21
- />
22
- </li>
23
- </ul>
8
+ <li>
9
+ otro tipo
10
+ </li>
11
+ <li>
12
+ business_concept_to_field_master
13
+ </li>
14
+ </ul>
15
+ </div>
24
16
  `;