@truedat/dd 4.44.0 → 4.44.3
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 +6 -6
- package/src/components/ImplementationStructuresLoader.js +14 -11
- package/src/components/PendingStructureNotes.js +10 -4
- package/src/components/__tests__/ImplementationStructuresLoader.spec.js +12 -54
- package/src/components/__tests__/LineageEventsTable.spec.js +2 -7
- package/src/components/__tests__/PendingStructureNoteRow.spec.js +1 -17
- package/src/components/__tests__/PendingStructureNotes.spec.js +5 -33
- package/src/components/__tests__/StructureGrantRequestButton.spec.js +4 -23
- package/src/components/__tests__/StructureNoteActions.spec.js +2 -19
- package/src/components/__tests__/StructureNotes.spec.js +3 -15
- package/src/components/__tests__/StructureNotesEdit.spec.js +3 -16
- package/src/components/__tests__/StructureTagForm.spec.js +1 -3
- package/src/components/__tests__/StructuresOptions.spec.js +1 -7
- package/src/components/__tests__/StructuresUploadEventsTable.spec.js +3 -4
- package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +3 -3
- package/src/components/__tests__/__snapshots__/StructureNavClassified.spec.js.snap +2 -2
- package/src/components/__tests__/__snapshots__/StructureNotes.spec.js.snap +9 -9
- package/src/components/__tests__/__snapshots__/StructureNotesEdit.spec.js.snap +2 -2
- package/src/components/__tests__/__snapshots__/ImplementationStructuresLoader.spec.js.snap +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.44.
|
|
3
|
+
"version": "4.44.3",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.14.1",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.44.
|
|
37
|
+
"@truedat/test": "4.44.3",
|
|
38
38
|
"babel-jest": "^27.0.6",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@truedat/auth": "4.44.
|
|
88
|
-
"@truedat/core": "4.44.
|
|
89
|
-
"@truedat/df": "4.44.
|
|
87
|
+
"@truedat/auth": "4.44.3",
|
|
88
|
+
"@truedat/core": "4.44.3",
|
|
89
|
+
"@truedat/df": "4.44.3",
|
|
90
90
|
"lodash": "^4.17.21",
|
|
91
91
|
"path-to-regexp": "^1.7.0",
|
|
92
92
|
"prop-types": "^15.7.2",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
108
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "d5e72d523389c6e66d6f7168d7e3546b5d2ffdda"
|
|
111
111
|
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { connect
|
|
4
|
+
import { connect } from "react-redux";
|
|
5
5
|
import { fetchStructure, clearStructure } from "../routines";
|
|
6
6
|
|
|
7
7
|
export const ImplementationStructuresLoader = ({
|
|
8
|
-
structureIds,
|
|
9
|
-
fetchStructure,
|
|
10
8
|
clearStructure,
|
|
9
|
+
fetchStructure,
|
|
10
|
+
structureIds,
|
|
11
|
+
structuresFields,
|
|
12
|
+
structuresSiblings,
|
|
11
13
|
}) => {
|
|
12
|
-
const structuresFields = useSelector((state) =>
|
|
13
|
-
_.keys(state.structuresFields)
|
|
14
|
-
);
|
|
15
|
-
const structuresSiblings = useSelector((state) =>
|
|
16
|
-
_.keys(state.structuresSiblings)
|
|
17
|
-
);
|
|
18
14
|
const structures = _.flow(
|
|
19
15
|
_.concat(structuresFields),
|
|
20
16
|
_.map(_.toInteger),
|
|
@@ -48,10 +44,17 @@ export const ImplementationStructuresLoader = ({
|
|
|
48
44
|
};
|
|
49
45
|
|
|
50
46
|
ImplementationStructuresLoader.propTypes = {
|
|
51
|
-
fetchStructure: PropTypes.func,
|
|
52
47
|
clearStructure: PropTypes.func,
|
|
48
|
+
fetchStructure: PropTypes.func,
|
|
49
|
+
structuresFields: PropTypes.array,
|
|
50
|
+
structuresSiblings: PropTypes.array,
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
export
|
|
53
|
+
export const mapStateToProps = ({ structuresFields, structuresSiblings }) => ({
|
|
54
|
+
structuresFields: _.keys(structuresFields),
|
|
55
|
+
structuresSiblings: _.keys(structuresSiblings),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export default connect(mapStateToProps, { fetchStructure, clearStructure })(
|
|
56
59
|
ImplementationStructuresLoader
|
|
57
60
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
|
-
import
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { connect } from "react-redux";
|
|
4
5
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
6
|
import { gql, useQuery } from "@apollo/client";
|
|
6
7
|
import { Checkbox, Form, Header, Icon, Segment } from "semantic-ui-react";
|
|
@@ -37,9 +38,8 @@ export const STRUCTURE_NOTES = gql`
|
|
|
37
38
|
|
|
38
39
|
const STATUS = ["pending_approval", "draft", "rejected"];
|
|
39
40
|
|
|
40
|
-
export const PendingStructureNotes = () => {
|
|
41
|
+
export const PendingStructureNotes = ({ systems }) => {
|
|
41
42
|
const { formatMessage } = useIntl();
|
|
42
|
-
const { systems } = useSelector(_.pick(["systems"]));
|
|
43
43
|
const [filter, setFilter] = useState({
|
|
44
44
|
statuses: STATUS,
|
|
45
45
|
});
|
|
@@ -146,4 +146,10 @@ export const PendingStructureNotes = () => {
|
|
|
146
146
|
);
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
PendingStructureNotes.propTypes = {
|
|
150
|
+
systems: PropTypes.array,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const mapStateToProps = ({ systems }) => ({ systems });
|
|
154
|
+
|
|
155
|
+
export default connect(mapStateToProps)(PendingStructureNotes);
|
|
@@ -1,63 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { ImplementationStructuresLoader } from "../ImplementationStructuresLoader";
|
|
4
4
|
|
|
5
|
-
jest.mock("@fluentui/react-component-event-listener", () => ({
|
|
6
|
-
documentRef: null,
|
|
7
|
-
windowRef: null,
|
|
8
|
-
}));
|
|
9
|
-
|
|
10
|
-
jest.mock("react-redux", () => ({
|
|
11
|
-
...jest.requireActual("react-redux"),
|
|
12
|
-
useSelector: jest.fn(() => [1]),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
const getProps = () => ({
|
|
16
|
-
fetchStructure: jest.fn(),
|
|
17
|
-
structureIds: [1, 2],
|
|
18
|
-
clearStructure: jest.fn(),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
5
|
describe("<ImplementationStructuresLoader/>", () => {
|
|
22
|
-
it("
|
|
23
|
-
const props =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const wrapper = mount(<ImplementationStructuresLoader {...props} />);
|
|
31
|
-
expect(props.fetchStructure).toHaveBeenCalledTimes(1);
|
|
32
|
-
expect(props.fetchStructure).toHaveBeenCalledWith({ id: 2 });
|
|
33
|
-
|
|
34
|
-
wrapper.unmount();
|
|
35
|
-
expect(props.fetchStructure).toHaveBeenCalledTimes(1);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("call fetchStructure when next id of structures when field id is already in structures fields", () => {
|
|
39
|
-
const props = { ...getProps(), structureIds: [1, 2] };
|
|
40
|
-
const wrapper = mount(<ImplementationStructuresLoader {...props} />);
|
|
41
|
-
expect(props.fetchStructure).toHaveBeenCalledTimes(1);
|
|
42
|
-
expect(props.fetchStructure).toHaveBeenCalledWith({ id: 2 });
|
|
43
|
-
|
|
44
|
-
wrapper.unmount();
|
|
6
|
+
it("calls fetchStructure on mount and clearStructure on unmount", () => {
|
|
7
|
+
const props = {
|
|
8
|
+
clearStructure: jest.fn(),
|
|
9
|
+
fetchStructure: jest.fn(),
|
|
10
|
+
structureIds: [42],
|
|
11
|
+
};
|
|
12
|
+
const { unmount } = render(<ImplementationStructuresLoader {...props} />);
|
|
13
|
+
expect(props.clearStructure).toHaveBeenCalledTimes(0);
|
|
45
14
|
expect(props.fetchStructure).toHaveBeenCalledTimes(1);
|
|
46
|
-
|
|
15
|
+
expect(props.fetchStructure).toHaveBeenCalledWith({ id: 42 });
|
|
47
16
|
|
|
48
|
-
|
|
49
|
-
const props = getProps();
|
|
50
|
-
const wrapper = mount(<ImplementationStructuresLoader {...props} />);
|
|
51
|
-
expect(props.clearStructure).toHaveBeenCalledTimes(0);
|
|
52
|
-
wrapper.unmount();
|
|
17
|
+
unmount();
|
|
53
18
|
expect(props.clearStructure).toHaveBeenCalledTimes(1);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
it("calls fetchStructures when structureIds is updated", () => {
|
|
57
|
-
const props = getProps();
|
|
58
|
-
const wrapper = mount(<ImplementationStructuresLoader {...props} />);
|
|
59
|
-
wrapper.setProps({ structureIds: [6, 5] });
|
|
60
|
-
expect(props.fetchStructure).toHaveBeenCalledTimes(2);
|
|
61
|
-
expect(props.fetchStructure).toHaveBeenCalledWith({ id: 5 });
|
|
19
|
+
expect(props.fetchStructure).toHaveBeenCalledTimes(1);
|
|
62
20
|
});
|
|
63
21
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { LineageEventsTable } from "../LineageEventsTable";
|
|
4
|
-
import en from "../../messages/en";
|
|
5
4
|
|
|
6
5
|
describe("<LineageEventsTable />", () => {
|
|
7
6
|
const lineageEvents = [
|
|
@@ -19,9 +18,7 @@ describe("<LineageEventsTable />", () => {
|
|
|
19
18
|
|
|
20
19
|
it("matches the latest snapshot", () => {
|
|
21
20
|
const props = { fetchLineageEvents, lineageEvents, lineageEventsLoading };
|
|
22
|
-
const { container } = render(<LineageEventsTable {...props}
|
|
23
|
-
messages: { en },
|
|
24
|
-
});
|
|
21
|
+
const { container } = render(<LineageEventsTable {...props} />);
|
|
25
22
|
expect(container).toMatchSnapshot();
|
|
26
23
|
});
|
|
27
24
|
|
|
@@ -31,9 +28,7 @@ describe("<LineageEventsTable />", () => {
|
|
|
31
28
|
lineageEvents: [],
|
|
32
29
|
lineageEventsLoading,
|
|
33
30
|
};
|
|
34
|
-
const { container } = render(<LineageEventsTable {...props}
|
|
35
|
-
messages: { en },
|
|
36
|
-
});
|
|
31
|
+
const { container } = render(<LineageEventsTable {...props} />);
|
|
37
32
|
expect(container).toMatchSnapshot();
|
|
38
33
|
});
|
|
39
34
|
});
|
|
@@ -3,21 +3,6 @@ import { waitFor } from "@testing-library/react";
|
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
4
|
import PendingStructureNoteRow from "../PendingStructureNoteRow";
|
|
5
5
|
|
|
6
|
-
const renderOpts = {
|
|
7
|
-
messages: {
|
|
8
|
-
en: {
|
|
9
|
-
"pendingStructureNotes.search.results.empty": "Empty",
|
|
10
|
-
"pendingStructureNotes.props.structure": "Structure",
|
|
11
|
-
"pendingStructureNotes.props.status": "Status",
|
|
12
|
-
"pendingStructureNotes.props.system": "System",
|
|
13
|
-
"pendingStructureNotes.props.domains": "Domains",
|
|
14
|
-
"structure.notes.status.deprecated": "Deprecated",
|
|
15
|
-
"structure.notes.status.draft": "Draft",
|
|
16
|
-
"structure.notes.status.rejected": "Rejected",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
6
|
const props = {
|
|
22
7
|
structureNote: {
|
|
23
8
|
id: "7207",
|
|
@@ -40,8 +25,7 @@ describe("<PendingStructureNoteRow />", () => {
|
|
|
40
25
|
<tbody>
|
|
41
26
|
<PendingStructureNoteRow {...props} />
|
|
42
27
|
</tbody>
|
|
43
|
-
</table
|
|
44
|
-
renderOpts
|
|
28
|
+
</table>
|
|
45
29
|
);
|
|
46
30
|
expect(container).toMatchSnapshot();
|
|
47
31
|
|
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
import React, { Suspense } from "react";
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
|
-
import {
|
|
5
|
-
PendingStructureNotes,
|
|
4
|
+
import PendingStructureNotes, {
|
|
6
5
|
STRUCTURE_NOTES,
|
|
7
6
|
} from "../PendingStructureNotes";
|
|
8
7
|
|
|
9
|
-
jest.mock("react-redux", () => ({
|
|
10
|
-
...jest.requireActual("react-redux"),
|
|
11
|
-
useSelector: jest.fn((selector) =>
|
|
12
|
-
selector({
|
|
13
|
-
systems: [
|
|
14
|
-
{ external_id: "some_external_id", id: 10, name: "some system" },
|
|
15
|
-
],
|
|
16
|
-
})
|
|
17
|
-
),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
8
|
const domains = [
|
|
21
9
|
{ id: 1, name: "Domain 1", level: 0 },
|
|
22
10
|
{ id: 2, name: "Domain 2", level: 0 },
|
|
23
11
|
];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"structure.notes.status.pending_approval": "Empty",
|
|
28
|
-
"pendingStructureNotes.filters": "Filters",
|
|
29
|
-
"pendingStructureNotes.props.status": "Status",
|
|
30
|
-
"pendingStructureNotes.props.system": "System",
|
|
31
|
-
"pendingStructureNotes.props.domains": "Domains",
|
|
32
|
-
"structure.notes.status.draft": "Draft",
|
|
33
|
-
"structure.notes.status.rejected": "Rejected",
|
|
34
|
-
"pendingStructureNotes.header": "Header",
|
|
35
|
-
"pendingStructureNotes.subheader": "Sub header",
|
|
36
|
-
"pendingStructureNotes.search.results.empty": "Serch Empty",
|
|
37
|
-
"domain.selector.placeholder": "Place Holder",
|
|
38
|
-
"domain.selector.label": "label",
|
|
39
|
-
"template.form.validation.empty_required": "empty required",
|
|
40
|
-
},
|
|
41
|
-
};
|
|
12
|
+
const systems = [
|
|
13
|
+
{ external_id: "some_external_id", id: 10, name: "some system" },
|
|
14
|
+
];
|
|
42
15
|
|
|
43
16
|
const structureNotes = {
|
|
44
17
|
loading: false,
|
|
@@ -77,8 +50,7 @@ const structureNotesMock = {
|
|
|
77
50
|
|
|
78
51
|
const renderOpts = {
|
|
79
52
|
mocks: [structureNotesMock],
|
|
80
|
-
|
|
81
|
-
state: { domains },
|
|
53
|
+
state: { domains, systems },
|
|
82
54
|
};
|
|
83
55
|
|
|
84
56
|
describe("<PendingStructureNotes />", () => {
|
|
@@ -2,25 +2,15 @@ import React from "react";
|
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import { render } from "@truedat/test/render";
|
|
5
|
-
|
|
6
5
|
import { StructureGrantRequestButton } from "../StructureGrantRequestButton";
|
|
7
6
|
|
|
8
|
-
import messages from "../../messages/en";
|
|
9
|
-
|
|
10
|
-
const renderOpts = {
|
|
11
|
-
messages: { en: messages },
|
|
12
|
-
};
|
|
13
|
-
|
|
14
7
|
describe("<StructureGrantRequestButton />", () => {
|
|
15
8
|
it("render a button", async () => {
|
|
16
9
|
const props = {
|
|
17
10
|
requested: false,
|
|
18
11
|
authorized: true,
|
|
19
12
|
};
|
|
20
|
-
const { getByText } = render(
|
|
21
|
-
<StructureGrantRequestButton {...props} />,
|
|
22
|
-
renderOpts
|
|
23
|
-
);
|
|
13
|
+
const { getByText } = render(<StructureGrantRequestButton {...props} />);
|
|
24
14
|
expect(getByText("Request grant")).toMatchSnapshot();
|
|
25
15
|
});
|
|
26
16
|
|
|
@@ -33,10 +23,7 @@ describe("<StructureGrantRequestButton />", () => {
|
|
|
33
23
|
removeGrantRequestFromCart: removeRequest,
|
|
34
24
|
authorized: true,
|
|
35
25
|
};
|
|
36
|
-
const { findByText } = render(
|
|
37
|
-
<StructureGrantRequestButton {...props} />,
|
|
38
|
-
renderOpts
|
|
39
|
-
);
|
|
26
|
+
const { findByText } = render(<StructureGrantRequestButton {...props} />);
|
|
40
27
|
userEvent.click(await findByText("Request grant"));
|
|
41
28
|
await waitFor(() => {
|
|
42
29
|
expect(addRequest.mock.calls.length).toBe(1);
|
|
@@ -53,10 +40,7 @@ describe("<StructureGrantRequestButton />", () => {
|
|
|
53
40
|
removeGrantRequestFromCart: removeRequest,
|
|
54
41
|
authorized: true,
|
|
55
42
|
};
|
|
56
|
-
const { findByText } = render(
|
|
57
|
-
<StructureGrantRequestButton {...props} />,
|
|
58
|
-
renderOpts
|
|
59
|
-
);
|
|
43
|
+
const { findByText } = render(<StructureGrantRequestButton {...props} />);
|
|
60
44
|
userEvent.click(await findByText("Pending request"));
|
|
61
45
|
await waitFor(() => {
|
|
62
46
|
expect(addRequest.mock.calls.length).toBe(0);
|
|
@@ -73,10 +57,7 @@ describe("<StructureGrantRequestButton />", () => {
|
|
|
73
57
|
removeGrantRequestFromCart: removeRequest,
|
|
74
58
|
authorized: false,
|
|
75
59
|
};
|
|
76
|
-
const component = render(
|
|
77
|
-
<StructureGrantRequestButton {...props} />,
|
|
78
|
-
renderOpts
|
|
79
|
-
);
|
|
60
|
+
const component = render(<StructureGrantRequestButton {...props} />);
|
|
80
61
|
const { queryAllByText } = component;
|
|
81
62
|
expect(queryAllByText("Request grant")).toHaveLength(0);
|
|
82
63
|
expect(queryAllByText("Pending request")).toHaveLength(0);
|
|
@@ -4,17 +4,6 @@ import { waitFor } from "@testing-library/react";
|
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
import { render } from "@truedat/test/render";
|
|
6
6
|
import { StructureNoteActions } from "../StructureNoteActions";
|
|
7
|
-
import messages from "../../messages/en";
|
|
8
|
-
|
|
9
|
-
const renderOpts = {
|
|
10
|
-
messages: {
|
|
11
|
-
en: {
|
|
12
|
-
...messages,
|
|
13
|
-
"confirmation.no": "No",
|
|
14
|
-
"confirmation.yes": "Yes",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
7
|
|
|
19
8
|
describe("<StructureNoteActions />", () => {
|
|
20
9
|
it("matches the latest snapshot", () => {
|
|
@@ -47,10 +36,7 @@ describe("<StructureNoteActions />", () => {
|
|
|
47
36
|
structure: { id: 1 },
|
|
48
37
|
};
|
|
49
38
|
|
|
50
|
-
const { findByText } = render(
|
|
51
|
-
<StructureNoteActions {...props} />,
|
|
52
|
-
renderOpts
|
|
53
|
-
);
|
|
39
|
+
const { findByText } = render(<StructureNoteActions {...props} />);
|
|
54
40
|
|
|
55
41
|
userEvent.click(await findByText(/Delete/));
|
|
56
42
|
|
|
@@ -85,10 +71,7 @@ describe("<StructureNoteActions />", () => {
|
|
|
85
71
|
structure: { id: 1 },
|
|
86
72
|
};
|
|
87
73
|
|
|
88
|
-
const { findByText } = render(
|
|
89
|
-
<StructureNoteActions {...props} />,
|
|
90
|
-
renderOpts
|
|
91
|
-
);
|
|
74
|
+
const { findByText } = render(<StructureNoteActions {...props} />);
|
|
92
75
|
|
|
93
76
|
userEvent.click(await findByText(/Send to approve/));
|
|
94
77
|
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import React, { Suspense } from "react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
|
-
import { intl } from "@truedat/test/intl-stub";
|
|
5
4
|
import { StructureNotes } from "../StructureNotes";
|
|
6
5
|
|
|
7
|
-
import messages from "../../messages/en";
|
|
8
|
-
|
|
9
|
-
const renderOpts = {
|
|
10
|
-
messages: { en: messages },
|
|
11
|
-
};
|
|
12
|
-
|
|
13
6
|
jest.mock("@truedat/df/components/DynamicFormViewer", () => {
|
|
14
7
|
const DynamicFormViewer = () => <div>DynamicFormViewer</div>;
|
|
15
8
|
return DynamicFormViewer;
|
|
16
9
|
});
|
|
17
10
|
|
|
18
|
-
// workaround for enzyme issue with React.useContext
|
|
19
|
-
// see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
|
|
20
|
-
jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
21
|
-
|
|
22
11
|
describe("<StructureNotes />", () => {
|
|
23
12
|
it("matches the latest snapshot", async () => {
|
|
24
13
|
const props = {
|
|
@@ -46,16 +35,15 @@ describe("<StructureNotes />", () => {
|
|
|
46
35
|
const { findByText, container } = render(
|
|
47
36
|
<Suspense fallback={null}>
|
|
48
37
|
<StructureNotes {...props} />
|
|
49
|
-
</Suspense
|
|
50
|
-
renderOpts
|
|
38
|
+
</Suspense>
|
|
51
39
|
);
|
|
52
40
|
expect(container).toMatchSnapshot();
|
|
53
41
|
|
|
54
|
-
userEvent.click(await findByText(
|
|
42
|
+
userEvent.click(await findByText("Show previous versions"));
|
|
55
43
|
|
|
56
44
|
expect(container).toMatchSnapshot();
|
|
57
45
|
|
|
58
|
-
userEvent.click(await findByText(
|
|
46
|
+
userEvent.click(await findByText("Show content"));
|
|
59
47
|
|
|
60
48
|
expect(container).toMatchSnapshot();
|
|
61
49
|
});
|
|
@@ -2,16 +2,9 @@ import React, { Suspense } from "react";
|
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import { render } from "@truedat/test/render";
|
|
5
|
-
import { intl } from "@truedat/test/intl-stub";
|
|
6
5
|
import { applyTemplate } from "@truedat/df/utils";
|
|
7
6
|
import { StructureNotesEdit } from "../StructureNotesEdit";
|
|
8
7
|
|
|
9
|
-
import messages from "../../messages/en";
|
|
10
|
-
|
|
11
|
-
const renderOpts = {
|
|
12
|
-
messages: { en: messages },
|
|
13
|
-
};
|
|
14
|
-
|
|
15
8
|
const DynamicForm = () => <div>DynamicForm</div>;
|
|
16
9
|
const TemplateLoader = () => <div>TemplateLoader</div>;
|
|
17
10
|
|
|
@@ -21,10 +14,6 @@ jest.mock(
|
|
|
21
14
|
() => TemplateLoader
|
|
22
15
|
);
|
|
23
16
|
|
|
24
|
-
// workaround for enzyme issue with React.useContext
|
|
25
|
-
// see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
|
|
26
|
-
jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
27
|
-
|
|
28
17
|
describe("<StructureNotesEdit />", () => {
|
|
29
18
|
it("matches the latest snapshot", () => {
|
|
30
19
|
const props = {
|
|
@@ -42,8 +31,7 @@ describe("<StructureNotesEdit />", () => {
|
|
|
42
31
|
const { container } = render(
|
|
43
32
|
<Suspense fallback={null}>
|
|
44
33
|
<StructureNotesEdit {...props} />
|
|
45
|
-
</Suspense
|
|
46
|
-
renderOpts
|
|
34
|
+
</Suspense>
|
|
47
35
|
);
|
|
48
36
|
expect(container).toMatchSnapshot();
|
|
49
37
|
});
|
|
@@ -82,11 +70,10 @@ describe("<StructureNotesEdit />", () => {
|
|
|
82
70
|
const { findByText } = render(
|
|
83
71
|
<Suspense fallback={null}>
|
|
84
72
|
<StructureNotesEdit {...props} />
|
|
85
|
-
</Suspense
|
|
86
|
-
renderOpts
|
|
73
|
+
</Suspense>
|
|
87
74
|
);
|
|
88
75
|
|
|
89
|
-
userEvent.click(await findByText(
|
|
76
|
+
userEvent.click(await findByText("Save"));
|
|
90
77
|
|
|
91
78
|
await waitFor(() => {
|
|
92
79
|
expect(doStructureNoteAction.mock.calls.length).toBe(1);
|
|
@@ -3,16 +3,14 @@ import { waitFor } from "@testing-library/react";
|
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import { render } from "@truedat/test/render";
|
|
5
5
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
6
|
-
import coreEn from "@truedat/core/messages/en";
|
|
7
6
|
import StructureTagForm from "../StructureTagForm";
|
|
8
|
-
import en from "../../messages/en";
|
|
9
7
|
|
|
10
8
|
const domainsMock = {
|
|
11
9
|
request: { query: DOMAINS_QUERY },
|
|
12
10
|
result: { data: { domains: [{ id: "123", name: "foo" }] } },
|
|
13
11
|
};
|
|
12
|
+
|
|
14
13
|
const renderOpts = {
|
|
15
|
-
messages: { en: { ...coreEn, ...en } },
|
|
16
14
|
mocks: [domainsMock],
|
|
17
15
|
};
|
|
18
16
|
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
|
-
import coreEn from "@truedat/core/messages/en";
|
|
5
4
|
import StructuresOptions from "../StructuresOptions";
|
|
6
|
-
import en from "../../messages/en";
|
|
7
|
-
|
|
8
|
-
const renderOpts = {
|
|
9
|
-
messages: { en: { ...coreEn, ...en } },
|
|
10
|
-
};
|
|
11
5
|
|
|
12
6
|
describe("<StructuresOptions />", () => {
|
|
13
7
|
const props = {
|
|
@@ -18,7 +12,7 @@ describe("<StructuresOptions />", () => {
|
|
|
18
12
|
};
|
|
19
13
|
|
|
20
14
|
it("matches the latest snapshot", async () => {
|
|
21
|
-
const { container } = render(<StructuresOptions {...props}
|
|
15
|
+
const { container } = render(<StructuresOptions {...props} />);
|
|
22
16
|
await waitFor(() => expect(container).toMatchSnapshot());
|
|
23
17
|
});
|
|
24
18
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import userEvent from "@testing-library/user-event";
|
|
4
3
|
import { render } from "@truedat/test/render";
|
|
5
|
-
import en from "../../messages/en";
|
|
6
4
|
import StructuresUploadEventsTable from "../StructuresUploadEventsTable";
|
|
7
5
|
|
|
8
6
|
const events = [
|
|
@@ -55,8 +53,9 @@ const events = [
|
|
|
55
53
|
];
|
|
56
54
|
|
|
57
55
|
const renderOpts = {
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
state: {
|
|
57
|
+
structuresUploadEvents: events,
|
|
58
|
+
},
|
|
60
59
|
};
|
|
61
60
|
|
|
62
61
|
describe("<StructuresUploadEventsTable />", () => {
|
|
@@ -16,11 +16,11 @@ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
|
|
|
16
16
|
<div
|
|
17
17
|
class="content"
|
|
18
18
|
>
|
|
19
|
-
|
|
19
|
+
Pending Notes
|
|
20
20
|
<div
|
|
21
21
|
class="sub header"
|
|
22
22
|
>
|
|
23
|
-
|
|
23
|
+
Structure notes pending some action
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
</h2>
|
|
@@ -50,7 +50,7 @@ exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
|
|
|
50
50
|
value=""
|
|
51
51
|
/>
|
|
52
52
|
<label>
|
|
53
|
-
|
|
53
|
+
Pending approval
|
|
54
54
|
</label>
|
|
55
55
|
</div>
|
|
56
56
|
<div
|
|
@@ -50,7 +50,7 @@ exports[`<StructureNavClassified /> matches the latest snapshot (leaf class expa
|
|
|
50
50
|
<div
|
|
51
51
|
class="header noselect"
|
|
52
52
|
>
|
|
53
|
-
|
|
53
|
+
unclassified
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
@@ -91,7 +91,7 @@ exports[`<StructureNavClassified /> matches the latest snapshot 1`] = `
|
|
|
91
91
|
<div
|
|
92
92
|
class="header noselect"
|
|
93
93
|
>
|
|
94
|
-
|
|
94
|
+
unclassified
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
</div>
|
|
@@ -20,7 +20,7 @@ exports[`<StructureNotes /> matches the latest snapshot 1`] = `
|
|
|
20
20
|
<button
|
|
21
21
|
class="ui button"
|
|
22
22
|
>
|
|
23
|
-
|
|
23
|
+
Show previous versions
|
|
24
24
|
</button>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
@@ -50,7 +50,7 @@ exports[`<StructureNotes /> matches the latest snapshot 2`] = `
|
|
|
50
50
|
<button
|
|
51
51
|
class="ui button"
|
|
52
52
|
>
|
|
53
|
-
|
|
53
|
+
Show previous versions
|
|
54
54
|
</button>
|
|
55
55
|
<div
|
|
56
56
|
class="ui segment"
|
|
@@ -62,19 +62,19 @@ exports[`<StructureNotes /> matches the latest snapshot 2`] = `
|
|
|
62
62
|
<div
|
|
63
63
|
class="ui label basic"
|
|
64
64
|
>
|
|
65
|
-
|
|
65
|
+
Versioned
|
|
66
66
|
</div>
|
|
67
67
|
<div
|
|
68
68
|
class="ui label basic"
|
|
69
69
|
>
|
|
70
|
-
|
|
70
|
+
Version: 1
|
|
71
71
|
</div>
|
|
72
72
|
</div>
|
|
73
73
|
<div>
|
|
74
74
|
<button
|
|
75
75
|
class="ui button"
|
|
76
76
|
>
|
|
77
|
-
|
|
77
|
+
Show content
|
|
78
78
|
</button>
|
|
79
79
|
</div>
|
|
80
80
|
</div>
|
|
@@ -107,7 +107,7 @@ exports[`<StructureNotes /> matches the latest snapshot 3`] = `
|
|
|
107
107
|
<button
|
|
108
108
|
class="ui button"
|
|
109
109
|
>
|
|
110
|
-
|
|
110
|
+
Show previous versions
|
|
111
111
|
</button>
|
|
112
112
|
<div
|
|
113
113
|
class="ui segment"
|
|
@@ -119,19 +119,19 @@ exports[`<StructureNotes /> matches the latest snapshot 3`] = `
|
|
|
119
119
|
<div
|
|
120
120
|
class="ui label basic"
|
|
121
121
|
>
|
|
122
|
-
|
|
122
|
+
Versioned
|
|
123
123
|
</div>
|
|
124
124
|
<div
|
|
125
125
|
class="ui label basic"
|
|
126
126
|
>
|
|
127
|
-
|
|
127
|
+
Version: 1
|
|
128
128
|
</div>
|
|
129
129
|
</div>
|
|
130
130
|
<div>
|
|
131
131
|
<button
|
|
132
132
|
class="ui button"
|
|
133
133
|
>
|
|
134
|
-
|
|
134
|
+
Hide content
|
|
135
135
|
</button>
|
|
136
136
|
</div>
|
|
137
137
|
</div>
|
|
@@ -12,14 +12,14 @@ exports[`<StructureNotesEdit /> matches the latest snapshot 1`] = `
|
|
|
12
12
|
<button
|
|
13
13
|
class="ui primary button"
|
|
14
14
|
>
|
|
15
|
-
|
|
15
|
+
Save
|
|
16
16
|
</button>
|
|
17
17
|
<a
|
|
18
18
|
class="ui secondary button"
|
|
19
19
|
href="/"
|
|
20
20
|
role="button"
|
|
21
21
|
>
|
|
22
|
-
|
|
22
|
+
Cancel
|
|
23
23
|
</a>
|
|
24
24
|
</form>
|
|
25
25
|
</div>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<ImplementationStructuresLoader/> matches the latest snapshot 1`] = `
|
|
4
|
-
<ImplementationStructuresLoader
|
|
5
|
-
clearStructure={[MockFunction]}
|
|
6
|
-
fetchStructure={
|
|
7
|
-
[MockFunction] {
|
|
8
|
-
"calls": Array [
|
|
9
|
-
Array [
|
|
10
|
-
Object {
|
|
11
|
-
"id": 2,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
],
|
|
15
|
-
"results": Array [
|
|
16
|
-
Object {
|
|
17
|
-
"type": "return",
|
|
18
|
-
"value": undefined,
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
structureIds={
|
|
24
|
-
Array [
|
|
25
|
-
1,
|
|
26
|
-
2,
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
/>
|
|
30
|
-
`;
|