@truedat/bg 8.12.2 → 8.12.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "8.12.2",
3
+ "version": "8.12.5",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -57,7 +57,7 @@
57
57
  "@testing-library/jest-dom": "^6.6.3",
58
58
  "@testing-library/react": "^16.3.0",
59
59
  "@testing-library/user-event": "^14.6.1",
60
- "@truedat/test": "8.12.2",
60
+ "@truedat/test": "8.12.5",
61
61
  "identity-obj-proxy": "^3.0.0",
62
62
  "jest": "^29.7.0",
63
63
  "redux-saga-test-plan": "^4.0.6"
@@ -90,5 +90,5 @@
90
90
  "semantic-ui-react": "^3.0.0-beta.2",
91
91
  "swr": "^2.3.3"
92
92
  },
93
- "gitHead": "b0000f1b2727cad43ce3c3eb2fa29681488dd2ec"
93
+ "gitHead": "71dd08262e6c26dd25466154c49fadb7b3449bd7"
94
94
  }
@@ -67,6 +67,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
67
67
  };
68
68
  });
69
69
  jest.mock("@truedat/core/hooks/useUserFilters");
70
+ jest.mock("@truedat/bg/hooks/useDomains");
70
71
 
71
72
  const link = {
72
73
  id: 745,
@@ -5,6 +5,8 @@ import { domainsMock } from "@truedat/test/mocks";
5
5
  import { ConceptManageDomainPopup } from "../ConceptManageDomainPopup";
6
6
 
7
7
  describe("<ConceptManageDomainPopup />", () => {
8
+ beforeEach(() => jest.useRealTimers());
9
+
8
10
  const props = {
9
11
  saving: false,
10
12
  update_domain: true,
@@ -17,6 +19,11 @@ describe("<ConceptManageDomainPopup />", () => {
17
19
  domainActions: undefined,
18
20
  ids: undefined,
19
21
  }),
22
+ domainsMock({
23
+ action: "manageConcept",
24
+ domainActions: undefined,
25
+ ids: undefined,
26
+ }),
20
27
  ],
21
28
  };
22
29
 
@@ -1,5 +1,4 @@
1
1
  import { render, waitForLoad } from "@truedat/test/render";
2
- import { waitFor } from "@testing-library/react";
3
2
  import { Concepts } from "../Concepts";
4
3
  import { defaultConceptColumns } from "../../selectors";
5
4
 
@@ -45,6 +44,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
45
44
  };
46
45
  });
47
46
  jest.mock("@truedat/core/hooks/useUserFilters");
47
+ jest.mock("@truedat/bg/hooks/useDomains");
48
48
 
49
49
  const state = {
50
50
  conceptsColumns: {
@@ -40,6 +40,8 @@ const renderOpts = {
40
40
  };
41
41
 
42
42
  describe("<ConceptsBulkUpdate />", () => {
43
+ beforeEach(() => jest.useRealTimers());
44
+
43
45
  it("matches the latest snapshot", async () => {
44
46
  const rendered = render(<ConceptsBulkUpdate />, renderOpts);
45
47
  await waitForLoad(rendered);
@@ -53,8 +55,9 @@ describe("<ConceptsBulkUpdate />", () => {
53
55
  await waitForLoad(rendered);
54
56
 
55
57
  await user.click(rendered.getByText(/foodomain/i));
56
- await waitFor(() =>
57
- expect(rendered.queryByText(/field1/i)).toBeInTheDocument(),
58
+ await waitFor(
59
+ () => expect(rendered.queryByText(/field1/i)).toBeInTheDocument(),
60
+ { timeout: 5000 },
58
61
  );
59
62
  });
60
63
 
@@ -68,8 +71,9 @@ describe("<ConceptsBulkUpdate />", () => {
68
71
  await waitForLoad(rendered);
69
72
 
70
73
  await user.click(rendered.getByText(/foodomain/i));
71
- await waitFor(() =>
72
- expect(rendered.queryByText(/field1/i)).toBeInTheDocument(),
74
+ await waitFor(
75
+ () => expect(rendered.queryByText(/field1/i)).toBeInTheDocument(),
76
+ { timeout: 5000 },
73
77
  );
74
78
 
75
79
  await user.type(rendered.getByPlaceholderText(/field1/i), "abc123456");
@@ -1,5 +1,4 @@
1
1
  import { render, waitForLoad } from "@truedat/test/render";
2
- import { waitFor } from "@testing-library/react";
3
2
  import ConceptsPanel from "../ConceptsPanel";
4
3
  import { defaultConceptColumns } from "../../selectors";
5
4
 
@@ -44,6 +43,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
44
43
  };
45
44
  });
46
45
  jest.mock("@truedat/core/hooks/useUserFilters");
46
+ jest.mock("@truedat/bg/hooks/useDomains");
47
47
 
48
48
  const state = {
49
49
  conceptsColumns: {
@@ -1,6 +1,16 @@
1
+ import { fireEvent } from "@testing-library/react";
1
2
  import { render, waitForLoad } from "@truedat/test/render";
2
3
  import { ConceptLinksApprovalsRow } from "../ConceptLinksApprovalsRow";
3
4
 
5
+ const renderRow = (props) =>
6
+ render(
7
+ <table>
8
+ <tbody>
9
+ <ConceptLinksApprovalsRow {...props} />
10
+ </tbody>
11
+ </table>,
12
+ );
13
+
4
14
  describe("ConceptLinksApprovalsRow", () => {
5
15
  const defaultProps = {
6
16
  checked: false,
@@ -35,34 +45,28 @@ describe("ConceptLinksApprovalsRow", () => {
35
45
  });
36
46
 
37
47
  it("renders row with checkbox when approveView is true", async () => {
38
- const rendered = render(
39
- <ConceptLinksApprovalsRow {...defaultProps} approveView={true} />,
40
- );
48
+ const rendered = renderRow({ ...defaultProps, approveView: true });
41
49
  await waitForLoad(rendered);
42
50
  expect(rendered.container).toMatchSnapshot();
43
51
  });
44
52
 
45
53
  it("renders row without checkbox when approveView is false", async () => {
46
- const rendered = render(
47
- <ConceptLinksApprovalsRow {...defaultProps} approveView={false} />,
48
- );
54
+ const rendered = renderRow({ ...defaultProps, approveView: false });
49
55
  await waitForLoad(rendered);
50
56
  expect(rendered.container).toMatchSnapshot();
51
57
  });
52
58
 
53
59
  it("calls onCheckboxChange when checkbox is clicked", async () => {
54
60
  const onCheckboxChange = jest.fn();
55
- const rendered = render(
56
- <ConceptLinksApprovalsRow
57
- {...defaultProps}
58
- approveView={true}
59
- onCheckboxChange={onCheckboxChange}
60
- />,
61
- );
61
+ const rendered = renderRow({
62
+ ...defaultProps,
63
+ approveView: true,
64
+ onCheckboxChange,
65
+ });
62
66
  await waitForLoad(rendered);
63
67
 
64
68
  const checkbox = rendered.container.querySelector("input[type='checkbox']");
65
- checkbox.click();
69
+ fireEvent.click(checkbox);
66
70
  expect(onCheckboxChange).toHaveBeenCalled();
67
71
  });
68
72
  });
@@ -70,6 +70,7 @@ jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
70
70
  });
71
71
 
72
72
  jest.mock("@truedat/core/hooks/useUserFilters");
73
+ jest.mock("@truedat/bg/hooks/useDomains");
73
74
 
74
75
  const concept = {
75
76
  id: 1,
@@ -28,7 +28,13 @@ describe("<ConceptRelationRow />", () => {
28
28
  tags,
29
29
  };
30
30
 
31
- const rendered = render(<ConceptRelationRow {...props} />);
31
+ const rendered = render(
32
+ <table>
33
+ <tbody>
34
+ <ConceptRelationRow {...props} />
35
+ </tbody>
36
+ </table>,
37
+ );
32
38
  await waitForLoad(rendered);
33
39
  expect(rendered.container).toMatchSnapshot();
34
40
  });
@@ -6,42 +6,50 @@ exports[`ConceptLinksApprovalsRow renders null when link is empty 1`] = `<div />
6
6
 
7
7
  exports[`ConceptLinksApprovalsRow renders row with checkbox when approveView is true 1`] = `
8
8
  <div>
9
- <tr
10
- class=""
11
- >
12
- <td
13
- class="collapsing center aligned one wide"
14
- >
15
- <div
16
- class="ui fitted checkbox"
9
+ <table>
10
+ <tbody>
11
+ <tr
12
+ class=""
17
13
  >
18
- <input
19
- class="hidden"
20
- id="123"
21
- readonly=""
22
- tabindex="0"
23
- type="checkbox"
14
+ <td
15
+ class="collapsing center aligned one wide"
16
+ >
17
+ <div
18
+ class="ui fitted checkbox"
19
+ >
20
+ <input
21
+ class="hidden"
22
+ id="123"
23
+ readonly=""
24
+ tabindex="0"
25
+ type="checkbox"
26
+ />
27
+ <label
28
+ for="123"
29
+ />
30
+ </div>
31
+ </td>
32
+ <td
33
+ class="left aligned"
24
34
  />
25
- <label
26
- for="123"
27
- />
28
- </div>
29
- </td>
30
- <td
31
- class="left aligned"
32
- />
33
- </tr>
35
+ </tr>
36
+ </tbody>
37
+ </table>
34
38
  </div>
35
39
  `;
36
40
 
37
41
  exports[`ConceptLinksApprovalsRow renders row without checkbox when approveView is false 1`] = `
38
42
  <div>
39
- <tr
40
- class=""
41
- >
42
- <td
43
- class="left aligned"
44
- />
45
- </tr>
43
+ <table>
44
+ <tbody>
45
+ <tr
46
+ class=""
47
+ >
48
+ <td
49
+ class="left aligned"
50
+ />
51
+ </tr>
52
+ </tbody>
53
+ </table>
46
54
  </div>
47
55
  `;
@@ -2,40 +2,44 @@
2
2
 
3
3
  exports[`<ConceptRelationRow /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <tr
6
- class=""
7
- >
8
- <td
9
- class=""
10
- >
11
- source
12
- </td>
13
- <td
14
- class="center aligned"
15
- >
16
- <div
17
- class="ui label"
5
+ <table>
6
+ <tbody>
7
+ <tr
8
+ class=""
18
9
  >
19
- -
20
- </div>
21
- </td>
22
- <td
23
- class="center aligned"
24
- >
25
- target
26
- </td>
27
- <td
28
- class="center aligned"
29
- >
30
- <button
31
- class="ui red mini basic compact icon button relation-actions__delete-button"
32
- >
33
- <i
34
- aria-hidden="true"
35
- class="red trash alternate outline small icon relation-actions__delete-icon"
36
- />
37
- </button>
38
- </td>
39
- </tr>
10
+ <td
11
+ class=""
12
+ >
13
+ source
14
+ </td>
15
+ <td
16
+ class="center aligned"
17
+ >
18
+ <div
19
+ class="ui label"
20
+ >
21
+ -
22
+ </div>
23
+ </td>
24
+ <td
25
+ class="center aligned"
26
+ >
27
+ target
28
+ </td>
29
+ <td
30
+ class="center aligned"
31
+ >
32
+ <button
33
+ class="ui red mini basic compact icon button relation-actions__delete-button"
34
+ >
35
+ <i
36
+ aria-hidden="true"
37
+ class="red trash alternate outline small icon relation-actions__delete-icon"
38
+ />
39
+ </button>
40
+ </td>
41
+ </tr>
42
+ </tbody>
43
+ </table>
40
44
  </div>
41
45
  `;
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import { createSelector } from "reselect";
3
2
  import { FormattedMessage } from "react-intl";
4
3
  import { Link } from "react-router";
5
4
  import DateTime from "@truedat/core/components/DateTime";
@@ -100,7 +99,6 @@ export const defaultBusinessConceptsLinksToImplementationsColumns = [
100
99
  },
101
100
  ];
102
101
 
103
- export const getBusinessConceptsLinksToImplementationsColumns = createSelector(
104
- _.prop("businessConceptsLinksToImplementationsColumns"),
105
- _.defaultTo(defaultBusinessConceptsLinksToImplementationsColumns),
106
- );
102
+ export const getBusinessConceptsLinksToImplementationsColumns = (state) =>
103
+ state.businessConceptsLinksToImplementationsColumns ??
104
+ defaultBusinessConceptsLinksToImplementationsColumns;
@@ -1,7 +1,6 @@
1
1
  import _ from "lodash/fp";
2
2
  import { Icon } from "semantic-ui-react";
3
3
  import { FormattedMessage } from "react-intl";
4
- import { createSelector } from "reselect";
5
4
  import Moment from "react-moment";
6
5
  import { Link } from "react-router";
7
6
  import { linkTo } from "@truedat/core/routes";
@@ -73,9 +72,7 @@ export const defaultConceptColumns = [
73
72
  },
74
73
  ];
75
74
 
76
- const getColumns = (state) => state.conceptsColumns;
75
+ const defaultColumns = { concepts: defaultConceptColumns };
77
76
 
78
- export const getConceptColumns = createSelector(
79
- getColumns,
80
- _.defaultTo({ concepts: defaultConceptColumns }),
81
- );
77
+ export const getConceptColumns = (state) =>
78
+ state.conceptsColumns ?? defaultColumns;
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import { createSelector } from "reselect";
3
2
  import { FormattedMessage } from "react-intl";
4
3
  import Moment from "react-moment";
5
4
  import { AlertExporter } from "@truedat/core/components/AlertExporter";
@@ -63,9 +62,5 @@ export const defaultConceptsUploadEventColumns = [
63
62
  },
64
63
  ];
65
64
 
66
- const getColumns = (state) => state.conceptsUploadEventColumns;
67
-
68
- export const getConceptUploadEventColumns = createSelector(
69
- [getColumns],
70
- (columns) => _.defaultTo(defaultConceptsUploadEventColumns)(columns),
71
- );
65
+ export const getConceptUploadEventColumns = (state) =>
66
+ state.conceptsUploadEventColumns ?? defaultConceptsUploadEventColumns;
@@ -1,5 +1,4 @@
1
1
  import userEvent from "@testing-library/user-event";
2
- import { act } from "@testing-library/react";
3
2
  import { render, waitForLoad } from "@truedat/test/render";
4
3
  import { DomainForm } from "../DomainForm";
5
4
  import { useDomains } from "../../../hooks/useDomains";
@@ -82,6 +81,8 @@ const data = [
82
81
  },
83
82
  ];
84
83
  describe("<DomainForm />", () => {
84
+ beforeEach(() => jest.useRealTimers());
85
+
85
86
  const onSubmit = jest.fn();
86
87
  const domain = { id: 1, name: "nn", external_id: "foo", description: "dd" };
87
88
  const isSubmitting = false;
@@ -105,16 +106,14 @@ describe("<DomainForm />", () => {
105
106
  ).toBeDisabled();
106
107
 
107
108
  const user = userEvent.setup({ delay: null });
108
- await act(async () => {
109
- await user.type(
110
- await rendered.findByRole("textbox", { name: /name/i }),
111
- "name",
112
- );
113
- await user.type(
114
- await rendered.findByRole("textbox", { name: /external_id/i }),
115
- "id",
116
- );
117
- });
109
+ await user.type(
110
+ await rendered.findByRole("textbox", { name: /name/i }),
111
+ "name",
112
+ );
113
+ await user.type(
114
+ await rendered.findByRole("textbox", { name: /external_id/i }),
115
+ "id",
116
+ );
118
117
 
119
118
  expect(
120
119
  await rendered.findByRole("button", { name: /save/i }),
@@ -1,6 +1,15 @@
1
1
  import { render, waitForLoad } from "@truedat/test/render";
2
2
  import { DomainMembers } from "../DomainMembers";
3
3
 
4
+ jest.mock("@truedat/core/hooks/useAclEntries", () => ({
5
+ ...jest.requireActual("@truedat/core/hooks/useAclEntries"),
6
+ useAclEntries: () => ({
7
+ data: { aclEntries: [], actions: { canCreate: false } },
8
+ loading: false,
9
+ mutate: jest.fn(),
10
+ }),
11
+ }));
12
+
4
13
  jest.mock("react-router", () => ({
5
14
  ...jest.requireActual("react-router"),
6
15
  useParams: jest.fn().mockReturnValue({ id: "1" }),
@@ -5,6 +5,7 @@ import { useDomainParentableIds } from "../../../hooks/useDomains";
5
5
 
6
6
  jest.mock("../../../hooks/useDomains", () => ({
7
7
  ...jest.requireActual("../../../hooks/useDomains"),
8
+ useDomains: jest.fn(() => ({ data: [] })),
8
9
  useDomainParentableIds: jest.fn(() => {}),
9
10
  }));
10
11