@truedat/dd 4.44.1 → 4.44.4
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/CHANGELOG.md +10 -0
- package/package.json +6 -6
- package/src/api/mutations.js +27 -0
- package/src/api/queries.js +24 -0
- package/src/api.js +2 -0
- package/src/components/DictionaryRoutes.js +7 -5
- package/src/components/FilteredNav.js +9 -9
- package/src/components/GrantRequestApprovalPopup.js +0 -1
- package/src/components/ImplementationStructuresLoader.js +14 -11
- package/src/components/PendingStructureNotes.js +10 -4
- package/src/components/ReferenceDataset.js +23 -0
- package/src/components/ReferenceDatasetActions.js +88 -0
- package/src/components/ReferenceDatasetBreadcrumbs.js +22 -0
- package/src/components/ReferenceDatasetCreate.js +36 -0
- package/src/components/ReferenceDatasetDetail.js +42 -0
- package/src/components/ReferenceDatasetForm.js +109 -0
- package/src/components/ReferenceDatasetHeader.js +32 -0
- package/src/components/ReferenceDatasetRoutes.js +56 -0
- package/src/components/ReferenceDatasetTable.js +42 -0
- package/src/components/ReferenceDatasets.js +61 -0
- package/src/components/ReferenceDatasetsTable.js +105 -0
- package/src/components/StructureTagsRoutes.js +0 -1
- package/src/components/StructureTypesCrumbs.js +0 -1
- package/src/components/StructureView.js +1 -3
- package/src/components/SystemForm.js +1 -1
- 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__/ReferenceDataset.spec.js +64 -0
- package/src/components/__tests__/ReferenceDatasetActions.spec.js +17 -0
- package/src/components/__tests__/ReferenceDatasetBreadcrumbs.spec.js +12 -0
- package/src/components/__tests__/ReferenceDatasetCreate.spec.js +12 -0
- package/src/components/__tests__/ReferenceDatasetDetail.spec.js +37 -0
- package/src/components/__tests__/ReferenceDatasetForm.spec.js +51 -0
- package/src/components/__tests__/ReferenceDatasetHeader.spec.js +17 -0
- package/src/components/__tests__/ReferenceDatasetRoutes.spec.js +74 -0
- package/src/components/__tests__/ReferenceDatasetTable.spec.js +18 -0
- package/src/components/__tests__/ReferenceDatasets.spec.js +32 -0
- package/src/components/__tests__/ReferenceDatasetsTable.spec.js +22 -0
- 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__/DictionaryRoutes.spec.js.snap +4 -0
- package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +3 -3
- package/src/components/__tests__/__snapshots__/ReferenceDataset.spec.js.snap +365 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetActions.spec.js.snap +65 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetBreadcrumbs.spec.js.snap +25 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetCreate.spec.js.snap +98 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetDetail.spec.js.snap +135 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetForm.spec.js.snap +61 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetHeader.spec.js.snap +95 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetRoutes.spec.js.snap +414 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetTable.spec.js.snap +75 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasets.spec.js.snap +128 -0
- package/src/components/__tests__/__snapshots__/ReferenceDatasetsTable.spec.js.snap +86 -0
- 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/messages/en.js +18 -0
- package/src/messages/es.js +20 -0
- package/src/reducers/__tests__/ddMessage.spec.js +26 -5
- package/src/reducers/__tests__/graph.spec.js +1 -6
- package/src/reducers/__tests__/referenceDatasetSaving.spec.js +44 -0
- package/src/reducers/__tests__/structureRedirect.spec.js +37 -13
- package/src/reducers/ddMessage.js +26 -1
- package/src/reducers/index.js +2 -0
- package/src/reducers/referenceDatasetSaving.js +16 -0
- package/src/reducers/structureRedirect.js +36 -15
- package/src/reducers/structuresUploadEvents.js +0 -1
- package/src/routines.js +35 -74
- package/src/sagas/__tests__/createReferenceDataset.spec.js +90 -0
- package/src/sagas/__tests__/deleteReferenceDataset.spec.js +81 -0
- package/src/sagas/__tests__/updateReferenceDataset.spec.js +116 -0
- package/src/sagas/createReferenceDataset.js +34 -0
- package/src/sagas/deleteReferenceDataset.js +29 -0
- package/src/sagas/downloadReferenceDataset.js +44 -0
- package/src/sagas/index.js +31 -22
- package/src/sagas/updateReferenceDataset.js +35 -0
- package/src/selectors/getRelationSortingCriteria.js +3 -5
- package/src/components/__tests__/__snapshots__/ImplementationStructuresLoader.spec.js.snap +0 -30
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import { render } from "@truedat/test/render";
|
|
5
|
+
import ReferenceDatasetForm from "../ReferenceDatasetForm";
|
|
6
|
+
|
|
7
|
+
const dataset = {
|
|
8
|
+
id: "123",
|
|
9
|
+
name: "foo",
|
|
10
|
+
headers: ["foo", "bar", "baz"],
|
|
11
|
+
rows: [
|
|
12
|
+
["foo1", "bar1", "baz1"],
|
|
13
|
+
["foo2", "bar2", "baz2"],
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe("<ReferenceDatasetForm />", () => {
|
|
18
|
+
const onSubmit = jest.fn();
|
|
19
|
+
const props = { dataset, onSubmit };
|
|
20
|
+
|
|
21
|
+
it("matches the latest snapshot", async () => {
|
|
22
|
+
const { container, findByText } = render(
|
|
23
|
+
<ReferenceDatasetForm {...props} />
|
|
24
|
+
);
|
|
25
|
+
await findByText("Save");
|
|
26
|
+
expect(container).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("form is disabled until modified", async () => {
|
|
30
|
+
const { findByText, findByRole, getByRole, queryByRole } = render(
|
|
31
|
+
<ReferenceDatasetForm {...props} />
|
|
32
|
+
);
|
|
33
|
+
await findByText("Save");
|
|
34
|
+
|
|
35
|
+
// Form is disabled until modified
|
|
36
|
+
expect(queryByRole("button", { name: /Save/ })).toBeDisabled();
|
|
37
|
+
userEvent.type(await findByRole("textbox"), "bar");
|
|
38
|
+
|
|
39
|
+
// Form is now enabled
|
|
40
|
+
await waitFor(() =>
|
|
41
|
+
expect(getByRole("button", { name: /Save/ })).not.toBeDisabled()
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// Submit
|
|
45
|
+
await waitFor(() => {
|
|
46
|
+
userEvent.click(getByRole("button", { name: /Save/ }));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(onSubmit).toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ReferenceDatasetHeader from "../ReferenceDatasetHeader";
|
|
4
|
+
|
|
5
|
+
const dataset = {
|
|
6
|
+
id: "123",
|
|
7
|
+
name: "foo",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
describe("<ReferenceDatasetHeader />", () => {
|
|
11
|
+
const props = { dataset };
|
|
12
|
+
|
|
13
|
+
it("matches the latest snapshot", () => {
|
|
14
|
+
const { container } = render(<ReferenceDatasetHeader {...props} />);
|
|
15
|
+
expect(container).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ReferenceDatasetRoutes from "../ReferenceDatasetRoutes";
|
|
4
|
+
import {
|
|
5
|
+
REFERENCE_DATASET_QUERY,
|
|
6
|
+
REFERENCE_DATASETS_QUERY,
|
|
7
|
+
} from "../../api/queries";
|
|
8
|
+
|
|
9
|
+
jest.mock("@truedat/core/hooks", () => ({
|
|
10
|
+
useAuthorized: jest.fn(() => true),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
const dataset = {
|
|
14
|
+
__typename: "ReferenceDataset",
|
|
15
|
+
id: "123",
|
|
16
|
+
name: "foo",
|
|
17
|
+
headers: ["foo", "bar", "baz"],
|
|
18
|
+
rowCount: 2,
|
|
19
|
+
rows: [
|
|
20
|
+
["foo1", "bar1", "baz1"],
|
|
21
|
+
["foo2", "bar2", "baz2"],
|
|
22
|
+
],
|
|
23
|
+
updatedAt: "2020-01-01T00:00:00.000Z",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const datasetsMock = {
|
|
27
|
+
request: { query: REFERENCE_DATASETS_QUERY },
|
|
28
|
+
result: { data: { referenceDatasets: [dataset] } },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const datasetMock = {
|
|
32
|
+
request: { query: REFERENCE_DATASET_QUERY, variables: { id: "123" } },
|
|
33
|
+
result: { data: { referenceDataset: dataset } },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
describe("<ReferenceDatasetRoutes />", () => {
|
|
37
|
+
const props = { dataset };
|
|
38
|
+
|
|
39
|
+
it("matches the latest snapshot (list route)", async () => {
|
|
40
|
+
const renderOpts = {
|
|
41
|
+
routes: ["/referenceDatasets"],
|
|
42
|
+
mocks: [datasetsMock],
|
|
43
|
+
};
|
|
44
|
+
const { container, findByText } = render(
|
|
45
|
+
<ReferenceDatasetRoutes {...props} />,
|
|
46
|
+
renderOpts
|
|
47
|
+
);
|
|
48
|
+
await findByText("foo");
|
|
49
|
+
expect(container).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("matches the latest snapshot (create route)", async () => {
|
|
53
|
+
const renderOpts = { routes: ["/referenceDatasets/new"] };
|
|
54
|
+
const { container, findByRole } = render(
|
|
55
|
+
<ReferenceDatasetRoutes {...props} />,
|
|
56
|
+
renderOpts
|
|
57
|
+
);
|
|
58
|
+
await findByRole("button", { name: "Save" });
|
|
59
|
+
expect(container).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("matches the latest snapshot (view route)", async () => {
|
|
63
|
+
const renderOpts = {
|
|
64
|
+
routes: ["/referenceDatasets/123"],
|
|
65
|
+
mocks: [datasetMock],
|
|
66
|
+
};
|
|
67
|
+
const { container, findByText } = render(
|
|
68
|
+
<ReferenceDatasetRoutes {...props} />,
|
|
69
|
+
renderOpts
|
|
70
|
+
);
|
|
71
|
+
await findByText("baz2");
|
|
72
|
+
expect(container).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ReferenceDatasetTable from "../ReferenceDatasetTable";
|
|
4
|
+
|
|
5
|
+
const props = {
|
|
6
|
+
headers: ["foo", "bar", "baz"],
|
|
7
|
+
rows: [
|
|
8
|
+
["foo1", "bar1", "baz1"],
|
|
9
|
+
["foo2", "bar2", "baz2"],
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe("<ReferenceDatasetTable />", () => {
|
|
14
|
+
it("matches the latest snapshot", () => {
|
|
15
|
+
const { container } = render(<ReferenceDatasetTable {...props} />);
|
|
16
|
+
expect(container).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ReferenceDatasets from "../ReferenceDatasets";
|
|
4
|
+
import { REFERENCE_DATASETS_QUERY } from "../../api/queries";
|
|
5
|
+
|
|
6
|
+
const dataset = {
|
|
7
|
+
__typename: "ReferenceDataset",
|
|
8
|
+
id: "123",
|
|
9
|
+
name: "foo",
|
|
10
|
+
headers: ["foo", "bar", "baz"],
|
|
11
|
+
rowCount: 2,
|
|
12
|
+
rows: [
|
|
13
|
+
["foo1", "bar1", "baz1"],
|
|
14
|
+
["foo2", "bar2", "baz2"],
|
|
15
|
+
],
|
|
16
|
+
updatedAt: "2020-01-01T00:00:00.000Z",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const datasetsMock = {
|
|
20
|
+
request: { query: REFERENCE_DATASETS_QUERY },
|
|
21
|
+
result: { data: { referenceDatasets: [dataset] } },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const renderOpts = { mocks: [datasetsMock] };
|
|
25
|
+
|
|
26
|
+
describe("<ReferenceDatasets />", () => {
|
|
27
|
+
it("matches the latest snapshot", async () => {
|
|
28
|
+
const { container, findByText } = render(<ReferenceDatasets />, renderOpts);
|
|
29
|
+
await findByText("One dataset found");
|
|
30
|
+
expect(container).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ReferenceDatasetsTable from "../ReferenceDatasetsTable";
|
|
4
|
+
|
|
5
|
+
const props = {
|
|
6
|
+
datasets: [
|
|
7
|
+
{
|
|
8
|
+
id: "123",
|
|
9
|
+
name: "foo",
|
|
10
|
+
headers: ["foo", "bar", "baz"],
|
|
11
|
+
rowCount: 2,
|
|
12
|
+
updatedAt: "2020-01-01T00:00:00.000Z",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe("<ReferenceDatasetsTable />", () => {
|
|
18
|
+
it("matches the latest snapshot", () => {
|
|
19
|
+
const { container } = render(<ReferenceDatasetsTable {...props} />);
|
|
20
|
+
expect(container).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -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
|