@truedat/cx 7.5.9 → 7.5.10
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 +40 -70
- package/src/configurations/components/Configuration.js +3 -3
- package/src/configurations/components/ConfigurationActions.js +1 -2
- package/src/configurations/components/ConfigurationBreadcrumbs.js +2 -3
- package/src/configurations/components/ConfigurationCards.js +1 -2
- package/src/configurations/components/ConfigurationForm.js +6 -11
- package/src/configurations/components/ConfigurationLoader.js +1 -2
- package/src/configurations/components/ConfigurationRoutes.js +61 -72
- package/src/configurations/components/ConfigurationTokenLoader.js +0 -1
- package/src/configurations/components/Configurations.js +2 -2
- package/src/configurations/components/ConfigurationsLoader.js +0 -1
- package/src/configurations/components/DynamicConfigurationForm.js +5 -7
- package/src/configurations/components/EditConfiguration.js +0 -1
- package/src/configurations/components/NewConfiguration.js +0 -1
- package/src/configurations/components/__tests__/Configuration.spec.js +17 -10
- package/src/configurations/components/__tests__/ConfigurationCards.spec.js +22 -13
- package/src/configurations/components/__tests__/ConfigurationForm.spec.js +5 -5
- package/src/configurations/components/__tests__/ConfigurationLoader.spec.js +44 -36
- package/src/configurations/components/__tests__/ConfigurationTokenLoader.spec.js +46 -45
- package/src/configurations/components/__tests__/Configurations.spec.js +20 -22
- package/src/configurations/components/__tests__/ConfigurationsLoader.spec.js +32 -33
- package/src/configurations/components/__tests__/EditConfiguration.spec.js +5 -5
- package/src/configurations/components/__tests__/NewConfiguration.spec.js +0 -1
- package/src/configurations/components/__tests__/__snapshots__/Configuration.spec.js.snap +122 -57
- package/src/configurations/components/__tests__/__snapshots__/ConfigurationCards.spec.js.snap +160 -361
- package/src/configurations/components/__tests__/__snapshots__/ConfigurationForm.spec.js.snap +7 -6
- package/src/configurations/components/__tests__/__snapshots__/ConfigurationLoader.spec.js.snap +5 -31
- package/src/configurations/components/__tests__/__snapshots__/ConfigurationTokenLoader.spec.js.snap +5 -9
- package/src/configurations/components/__tests__/__snapshots__/Configurations.spec.js.snap +91 -72
- package/src/configurations/components/__tests__/__snapshots__/ConfigurationsLoader.spec.js.snap +5 -27
- package/src/configurations/components/__tests__/__snapshots__/EditConfiguration.spec.js.snap +12 -10
- package/src/configurations/components/__tests__/__snapshots__/NewConfiguration.spec.js.snap +11 -9
- package/src/configurations/components/index.js +1 -1
- package/src/configurations/reducers/configurationRedirect.js +1 -1
- package/src/configurations/reducers/configurations.js +1 -1
- package/src/configurations/reducers/index.js +1 -1
- package/src/configurations/reducers/systemConfigurations.js +1 -1
- package/src/configurations/sagas/signConfiguration.js +3 -1
- package/src/jobs/components/Job.js +0 -1
- package/src/jobs/components/JobBreadcrumbs.js +2 -3
- package/src/jobs/components/JobLoader.js +2 -2
- package/src/jobs/components/JobRoutes.js +28 -40
- package/src/jobs/components/JobRow.js +4 -4
- package/src/jobs/components/Jobs.js +5 -4
- package/src/jobs/components/JobsLabelResults.js +2 -3
- package/src/jobs/components/JobsSearch.js +0 -1
- package/src/jobs/components/JobsTable.js +3 -3
- package/src/jobs/components/JobsView.js +0 -1
- package/src/jobs/components/SourceJobs.js +0 -1
- package/src/jobs/components/__tests__/Job.spec.js +9 -11
- package/src/jobs/components/__tests__/JobBreadcrumbs.spec.js +5 -5
- package/src/jobs/components/__tests__/JobLoader.spec.js +12 -12
- package/src/jobs/components/__tests__/JobRow.spec.js +21 -20
- package/src/jobs/components/__tests__/Jobs.spec.js +1 -7
- package/src/jobs/components/__tests__/JobsLoader.spec.js +9 -9
- package/src/jobs/components/__tests__/JobsTable.spec.js +33 -28
- package/src/jobs/components/__tests__/JobsView.spec.js +1 -7
- package/src/jobs/components/__tests__/SourceJobs.spec.js +1 -7
- package/src/jobs/components/__tests__/__snapshots__/Job.spec.js.snap +143 -36
- package/src/jobs/components/__tests__/__snapshots__/JobBreadcrumbs.spec.js.snap +20 -30
- package/src/jobs/components/__tests__/__snapshots__/Jobs.spec.js.snap +10 -23
- package/src/jobs/components/__tests__/__snapshots__/JobsTable.spec.js.snap +7 -7
- package/src/jobs/components/__tests__/__snapshots__/JobsView.spec.js.snap +12 -24
- package/src/jobs/components/__tests__/__snapshots__/SourceJobs.spec.js.snap +8 -21
- package/src/jobs/reducers/jobActiveFilters.js +1 -1
- package/src/jobs/sagas/fetchJob.js +1 -1
- package/src/jobs/selectors/jobColumnsSelector.js +0 -1
- package/src/jobs/selectors/sourceJobColumnsSelector.js +0 -1
- package/src/sources/components/EditSource.js +0 -1
- package/src/sources/components/JobForm.js +1 -1
- package/src/sources/components/NewJob.js +0 -1
- package/src/sources/components/NewSource.js +0 -1
- package/src/sources/components/Source.js +0 -1
- package/src/sources/components/SourceActions.js +1 -2
- package/src/sources/components/SourceBreadcrumbs.js +1 -2
- package/src/sources/components/SourceConfiguration.js +3 -3
- package/src/sources/components/SourceDetail.js +46 -50
- package/src/sources/components/SourceForm.js +4 -7
- package/src/sources/components/SourceHeader.js +0 -1
- package/src/sources/components/SourceRoutes.js +30 -23
- package/src/sources/components/SourceSelector.js +0 -1
- package/src/sources/components/SourceTabs.js +14 -7
- package/src/sources/components/Sources.js +2 -2
- package/src/sources/components/SourcesTable.js +1 -2
- package/src/sources/components/__tests__/EditSource.spec.js +10 -12
- package/src/sources/components/__tests__/NewSource.spec.js +5 -10
- package/src/sources/components/__tests__/Source.spec.js +19 -27
- package/src/sources/components/__tests__/SourceActions.spec.js +1 -2
- package/src/sources/components/__tests__/SourceBreadcrumbs.spec.js +0 -1
- package/src/sources/components/__tests__/SourceDetail.spec.js +62 -38
- package/src/sources/components/__tests__/SourceForm.spec.js +109 -86
- package/src/sources/components/__tests__/SourceHeader.spec.js +1 -2
- package/src/sources/components/__tests__/SourceRoutes.spec.js +79 -7
- package/src/sources/components/__tests__/SourceSelector.spec.js +0 -1
- package/src/sources/components/__tests__/SourceTabs.spec.js +3 -4
- package/src/sources/components/__tests__/Sources.spec.js +24 -39
- package/src/sources/components/__tests__/SourcesTable.spec.js +48 -65
- package/src/sources/components/__tests__/__snapshots__/EditSource.spec.js.snap +134 -15
- package/src/sources/components/__tests__/__snapshots__/NewSource.spec.js.snap +36 -23
- package/src/sources/components/__tests__/__snapshots__/Source.spec.js.snap +28 -31
- package/src/sources/components/__tests__/__snapshots__/SourceActions.spec.js.snap +1 -1
- package/src/sources/components/__tests__/__snapshots__/SourceBreadcrumbs.spec.js.snap +2 -1
- package/src/sources/components/__tests__/__snapshots__/SourceDetail.spec.js.snap +13 -172
- package/src/sources/components/__tests__/__snapshots__/SourceForm.spec.js.snap +132 -106
- package/src/sources/components/__tests__/__snapshots__/SourceHeader.spec.js.snap +4 -4
- package/src/sources/components/__tests__/__snapshots__/SourceRoutes.spec.js.snap +47 -5
- package/src/sources/components/__tests__/__snapshots__/SourceTabs.spec.js.snap +5 -3
- package/src/sources/components/__tests__/__snapshots__/Sources.spec.js.snap +14 -11
- package/src/sources/components/__tests__/__snapshots__/SourcesTable.spec.js.snap +17 -12
- package/src/jobs/components/ConfigurationRoutes.js +0 -31
|
@@ -1,72 +1,80 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { ConfigurationLoader } from "../ConfigurationLoader";
|
|
4
3
|
|
|
5
|
-
jest.mock("react-router
|
|
6
|
-
...jest.requireActual("react-router
|
|
7
|
-
useParams: () => ({ external_id: 1 })
|
|
4
|
+
jest.mock("react-router", () => ({
|
|
5
|
+
...jest.requireActual("react-router"),
|
|
6
|
+
useParams: () => ({ external_id: 1 }),
|
|
8
7
|
}));
|
|
9
8
|
|
|
10
9
|
describe("<ConfigurationLoader />", () => {
|
|
11
|
-
const configurationLoading = false;
|
|
12
10
|
const fetchConfiguration = jest.fn();
|
|
13
11
|
const clearConfiguration = jest.fn();
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const renderOpts = {
|
|
14
|
+
state: {
|
|
15
|
+
configurations: {
|
|
16
|
+
loading: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
dispatch: jest.fn(),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
it("matches the latest snapshot", async () => {
|
|
17
23
|
const props = {
|
|
18
24
|
clearConfiguration,
|
|
19
25
|
fetchConfiguration,
|
|
20
|
-
configurationLoading
|
|
26
|
+
configurationLoading: true,
|
|
21
27
|
};
|
|
22
|
-
const
|
|
23
|
-
expect(
|
|
28
|
+
const rendered = render(<ConfigurationLoader {...props} />, renderOpts);
|
|
29
|
+
expect(rendered.container).toMatchSnapshot();
|
|
24
30
|
});
|
|
25
31
|
|
|
26
|
-
it("renders a loader if configurationLoading is true", () => {
|
|
27
|
-
const configurationLoading = true;
|
|
32
|
+
it("renders a loader if configurationLoading is true", async () => {
|
|
28
33
|
const props = {
|
|
29
34
|
clearConfiguration,
|
|
30
35
|
fetchConfiguration,
|
|
31
|
-
configurationLoading
|
|
36
|
+
configurationLoading: true,
|
|
32
37
|
};
|
|
33
|
-
const
|
|
34
|
-
expect(
|
|
38
|
+
const rendered = render(<ConfigurationLoader {...props} />, renderOpts);
|
|
39
|
+
expect(rendered.container.querySelector(".loader")).toBeInTheDocument();
|
|
35
40
|
});
|
|
36
41
|
|
|
37
|
-
it("renders null if configurationLoading is false", () => {
|
|
42
|
+
it("renders null if configurationLoading is false", async () => {
|
|
38
43
|
const props = {
|
|
39
44
|
clearConfiguration,
|
|
40
45
|
fetchConfiguration,
|
|
41
|
-
configurationLoading: false
|
|
46
|
+
configurationLoading: false,
|
|
42
47
|
};
|
|
43
|
-
const
|
|
44
|
-
|
|
48
|
+
const rendered = render(<ConfigurationLoader {...props} />, renderOpts);
|
|
49
|
+
await waitForLoad(rendered);
|
|
50
|
+
expect(rendered.container).toBeEmptyDOMElement();
|
|
45
51
|
});
|
|
46
52
|
|
|
47
|
-
it("calls fetchConfiguration when component mounts but not when it unmounts", () => {
|
|
48
|
-
const
|
|
53
|
+
it("calls fetchConfiguration when component mounts but not when it unmounts", async () => {
|
|
54
|
+
const fetchConfigurationMock = jest.fn();
|
|
49
55
|
const props = {
|
|
50
56
|
clearConfiguration,
|
|
51
|
-
fetchConfiguration,
|
|
52
|
-
configurationLoading
|
|
57
|
+
fetchConfiguration: fetchConfigurationMock,
|
|
58
|
+
configurationLoading: false,
|
|
53
59
|
};
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
const rendered = render(<ConfigurationLoader {...props} />, renderOpts);
|
|
61
|
+
await waitForLoad(rendered);
|
|
62
|
+
expect(fetchConfigurationMock).toHaveBeenCalledTimes(1);
|
|
63
|
+
rendered.unmount();
|
|
64
|
+
expect(fetchConfigurationMock).toHaveBeenCalledTimes(1);
|
|
58
65
|
});
|
|
59
66
|
|
|
60
|
-
it("calls clearConfiguration when component unmounts but not when it mounts", () => {
|
|
61
|
-
const
|
|
67
|
+
it("calls clearConfiguration when component unmounts but not when it mounts", async () => {
|
|
68
|
+
const clearConfigurationMock = jest.fn();
|
|
62
69
|
const props = {
|
|
63
|
-
clearConfiguration,
|
|
70
|
+
clearConfiguration: clearConfigurationMock,
|
|
64
71
|
fetchConfiguration,
|
|
65
|
-
configurationLoading
|
|
72
|
+
configurationLoading: false,
|
|
66
73
|
};
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
const rendered = render(<ConfigurationLoader {...props} />, renderOpts);
|
|
75
|
+
await waitForLoad(rendered);
|
|
76
|
+
expect(clearConfigurationMock).not.toHaveBeenCalled();
|
|
77
|
+
rendered.unmount();
|
|
78
|
+
expect(clearConfigurationMock).toHaveBeenCalledTimes(1);
|
|
71
79
|
});
|
|
72
80
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { ConfigurationTokenLoader } from "../ConfigurationTokenLoader";
|
|
4
3
|
|
|
5
4
|
describe("<ConfigurationTokenLoader />", () => {
|
|
6
|
-
const configurationTokenLoading = false;
|
|
7
5
|
const clearDashboardDomains = jest.fn();
|
|
8
6
|
const clearConfigurationToken = jest.fn();
|
|
9
7
|
const signConfiguration = jest.fn();
|
|
@@ -11,21 +9,21 @@ describe("<ConfigurationTokenLoader />", () => {
|
|
|
11
9
|
const dashboardDomains = [1, 2];
|
|
12
10
|
const externalId = "externalId";
|
|
13
11
|
|
|
14
|
-
it("matches the latest snapshot", () => {
|
|
12
|
+
it("matches the latest snapshot", async () => {
|
|
15
13
|
const props = {
|
|
16
14
|
clearDashboardDomains,
|
|
17
15
|
clearConfigurationToken,
|
|
18
|
-
configurationTokenLoading,
|
|
16
|
+
configurationTokenLoading: true,
|
|
19
17
|
dashboardId,
|
|
20
18
|
dashboardDomains: [],
|
|
21
19
|
externalId,
|
|
22
|
-
signConfiguration
|
|
20
|
+
signConfiguration,
|
|
23
21
|
};
|
|
24
|
-
const
|
|
25
|
-
expect(
|
|
22
|
+
const rendered = render(<ConfigurationTokenLoader {...props} />);
|
|
23
|
+
expect(rendered.container).toMatchSnapshot();
|
|
26
24
|
});
|
|
27
25
|
|
|
28
|
-
it("renders a loader if configurationTokenLoading is true", () => {
|
|
26
|
+
it("renders a loader if configurationTokenLoading is true", async () => {
|
|
29
27
|
const props = {
|
|
30
28
|
clearDashboardDomains,
|
|
31
29
|
clearConfigurationToken,
|
|
@@ -33,76 +31,79 @@ describe("<ConfigurationTokenLoader />", () => {
|
|
|
33
31
|
dashboardId,
|
|
34
32
|
dashboardDomains,
|
|
35
33
|
externalId,
|
|
36
|
-
signConfiguration
|
|
34
|
+
signConfiguration,
|
|
37
35
|
};
|
|
38
|
-
const
|
|
39
|
-
expect(
|
|
36
|
+
const rendered = render(<ConfigurationTokenLoader {...props} />);
|
|
37
|
+
expect(rendered.container.querySelector(".loader")).toBeInTheDocument();
|
|
40
38
|
});
|
|
41
39
|
|
|
42
|
-
it("renders null if configurationTokenLoading is false", () => {
|
|
40
|
+
it("renders null if configurationTokenLoading is false", async () => {
|
|
43
41
|
const props = {
|
|
44
42
|
clearDashboardDomains,
|
|
45
43
|
clearConfigurationToken,
|
|
46
|
-
configurationTokenLoading,
|
|
44
|
+
configurationTokenLoading: false,
|
|
47
45
|
dashboardId,
|
|
48
46
|
dashboardDomains,
|
|
49
47
|
externalId,
|
|
50
|
-
signConfiguration
|
|
48
|
+
signConfiguration,
|
|
51
49
|
};
|
|
52
|
-
const
|
|
53
|
-
|
|
50
|
+
const rendered = render(<ConfigurationTokenLoader {...props} />);
|
|
51
|
+
await waitForLoad(rendered);
|
|
52
|
+
expect(rendered.container).toBeEmptyDOMElement();
|
|
54
53
|
});
|
|
55
54
|
|
|
56
|
-
it("calls signConfiguration when component mounts but not when it unmounts", () => {
|
|
57
|
-
|
|
55
|
+
it("calls signConfiguration when component mounts but not when it unmounts", async () => {
|
|
56
|
+
const signConfigurationMock = jest.fn();
|
|
58
57
|
const props = {
|
|
59
58
|
clearDashboardDomains,
|
|
60
59
|
clearConfigurationToken,
|
|
61
|
-
configurationTokenLoading,
|
|
60
|
+
configurationTokenLoading: false,
|
|
62
61
|
dashboardId,
|
|
63
62
|
dashboardDomains,
|
|
64
63
|
externalId,
|
|
65
|
-
signConfiguration
|
|
64
|
+
signConfiguration: signConfigurationMock,
|
|
66
65
|
};
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
const rendered = render(<ConfigurationTokenLoader {...props} />);
|
|
67
|
+
await waitForLoad(rendered);
|
|
68
|
+
expect(signConfigurationMock).toHaveBeenCalledTimes(1);
|
|
69
|
+
rendered.unmount();
|
|
70
|
+
expect(signConfigurationMock).toHaveBeenCalledTimes(1);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
it("does not call signConfiguration when component mounts and dashboardDomains are empty", () => {
|
|
74
|
-
|
|
73
|
+
it("does not call signConfiguration when component mounts and dashboardDomains are empty", async () => {
|
|
74
|
+
const signConfigurationMock = jest.fn();
|
|
75
75
|
const props = {
|
|
76
76
|
clearDashboardDomains,
|
|
77
77
|
clearConfigurationToken,
|
|
78
|
-
configurationTokenLoading,
|
|
78
|
+
configurationTokenLoading: false,
|
|
79
79
|
dashboardId,
|
|
80
80
|
dashboardDomains: [],
|
|
81
81
|
externalId,
|
|
82
|
-
signConfiguration
|
|
82
|
+
signConfiguration: signConfigurationMock,
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const rendered = render(<ConfigurationTokenLoader {...props} />);
|
|
85
|
+
await waitForLoad(rendered);
|
|
86
|
+
expect(signConfigurationMock).not.toHaveBeenCalled();
|
|
86
87
|
});
|
|
87
88
|
|
|
88
|
-
it("calls clearConfigurationToken and clearDashboardDomains when component unmounts but not when it mounts", () => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
it("calls clearConfigurationToken and clearDashboardDomains when component unmounts but not when it mounts", async () => {
|
|
90
|
+
const clearDashboardDomainsMock = jest.fn();
|
|
91
|
+
const clearConfigurationTokenMock = jest.fn();
|
|
92
92
|
const props = {
|
|
93
|
-
clearDashboardDomains,
|
|
94
|
-
clearConfigurationToken,
|
|
95
|
-
configurationTokenLoading,
|
|
93
|
+
clearDashboardDomains: clearDashboardDomainsMock,
|
|
94
|
+
clearConfigurationToken: clearConfigurationTokenMock,
|
|
95
|
+
configurationTokenLoading: false,
|
|
96
96
|
dashboardId,
|
|
97
97
|
dashboardDomains,
|
|
98
98
|
externalId,
|
|
99
|
-
signConfiguration
|
|
99
|
+
signConfiguration,
|
|
100
100
|
};
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
expect(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
expect(
|
|
101
|
+
const rendered = render(<ConfigurationTokenLoader {...props} />);
|
|
102
|
+
await waitForLoad(rendered);
|
|
103
|
+
expect(clearDashboardDomainsMock).not.toHaveBeenCalled();
|
|
104
|
+
expect(clearConfigurationTokenMock).not.toHaveBeenCalled();
|
|
105
|
+
rendered.unmount();
|
|
106
|
+
expect(clearDashboardDomainsMock).toHaveBeenCalledTimes(1);
|
|
107
|
+
expect(clearConfigurationTokenMock).toHaveBeenCalledTimes(1);
|
|
107
108
|
});
|
|
108
109
|
});
|
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { shallow } from "enzyme";
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
3
|
import { Configurations } from "../Configurations";
|
|
5
4
|
|
|
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
5
|
describe("<Configurations />", () => {
|
|
11
6
|
const defaultProps = {
|
|
12
7
|
configurationsLoading: false,
|
|
13
|
-
configurations: [{ id: 1, external_id: "eid1" }]
|
|
8
|
+
configurations: [{ id: 1, external_id: "eid1", type: "test" }],
|
|
14
9
|
};
|
|
15
10
|
|
|
16
|
-
it("matches the latest snapshot", () => {
|
|
17
|
-
const
|
|
18
|
-
|
|
11
|
+
it("matches the latest snapshot", async () => {
|
|
12
|
+
const rendered = render(<Configurations {...defaultProps} />);
|
|
13
|
+
await waitForLoad(rendered);
|
|
14
|
+
expect(rendered.container).toMatchSnapshot();
|
|
19
15
|
});
|
|
20
16
|
|
|
21
|
-
it("renders no results when configurations search result is empty", () => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
it("renders no results when configurations search result is empty", async () => {
|
|
18
|
+
const rendered = render(<Configurations {...defaultProps} />);
|
|
19
|
+
await waitForLoad(rendered);
|
|
20
|
+
|
|
21
|
+
const user = userEvent.setup({ delay: null });
|
|
22
|
+
const searchInput = rendered.getByPlaceholderText(/search/i);
|
|
23
|
+
await user.type(searchInput, "bank");
|
|
24
|
+
|
|
25
|
+
expect(rendered.queryByText(/eid1/i)).not.toBeInTheDocument();
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
it("renders null if configurationsLoading is
|
|
28
|
+
it("renders null if configurationsLoading is true", async () => {
|
|
31
29
|
const props = {
|
|
32
30
|
configurations: [],
|
|
33
|
-
configurationsLoading: true
|
|
31
|
+
configurationsLoading: true,
|
|
34
32
|
};
|
|
35
|
-
const
|
|
36
|
-
expect(
|
|
33
|
+
const rendered = render(<Configurations {...props} />);
|
|
34
|
+
expect(rendered.container).toBeEmptyDOMElement();
|
|
37
35
|
});
|
|
38
36
|
});
|
|
@@ -1,67 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { ConfigurationsLoader } from "../ConfigurationsLoader";
|
|
4
3
|
|
|
5
4
|
describe("<ConfigurationsLoader />", () => {
|
|
6
|
-
const configurationsLoading = false;
|
|
7
5
|
const fetchConfigurations = jest.fn();
|
|
8
6
|
const clearConfigurations = jest.fn();
|
|
9
7
|
|
|
10
|
-
it("matches the latest snapshot", () => {
|
|
11
|
-
const configurationsLoading = true;
|
|
8
|
+
it("matches the latest snapshot", async () => {
|
|
12
9
|
const props = {
|
|
13
10
|
clearConfigurations,
|
|
14
11
|
fetchConfigurations,
|
|
15
|
-
configurationsLoading
|
|
12
|
+
configurationsLoading: true,
|
|
16
13
|
};
|
|
17
|
-
const
|
|
18
|
-
expect(
|
|
14
|
+
const rendered = render(<ConfigurationsLoader {...props} />);
|
|
15
|
+
expect(rendered.container).toMatchSnapshot();
|
|
19
16
|
});
|
|
20
17
|
|
|
21
|
-
it("renders a loader if configurationsLoading is true", () => {
|
|
22
|
-
const configurationsLoading = true;
|
|
18
|
+
it("renders a loader if configurationsLoading is true", async () => {
|
|
23
19
|
const props = {
|
|
24
20
|
clearConfigurations,
|
|
25
21
|
fetchConfigurations,
|
|
26
|
-
configurationsLoading
|
|
22
|
+
configurationsLoading: true,
|
|
27
23
|
};
|
|
28
|
-
const
|
|
29
|
-
expect(
|
|
24
|
+
const rendered = render(<ConfigurationsLoader {...props} />);
|
|
25
|
+
expect(rendered.container.querySelector(".loader")).toBeInTheDocument();
|
|
30
26
|
});
|
|
31
27
|
|
|
32
|
-
it("renders null if configurationsLoading is false", () => {
|
|
28
|
+
it("renders null if configurationsLoading is false", async () => {
|
|
33
29
|
const props = {
|
|
34
30
|
clearConfigurations,
|
|
35
31
|
fetchConfigurations,
|
|
36
|
-
configurationsLoading: false
|
|
32
|
+
configurationsLoading: false,
|
|
37
33
|
};
|
|
38
|
-
const
|
|
39
|
-
|
|
34
|
+
const rendered = render(<ConfigurationsLoader {...props} />);
|
|
35
|
+
await waitForLoad(rendered);
|
|
36
|
+
expect(rendered.container).toBeEmptyDOMElement();
|
|
40
37
|
});
|
|
41
38
|
|
|
42
|
-
it("calls fetchConfigurations when component mounts but not when it unmounts", () => {
|
|
43
|
-
const
|
|
39
|
+
it("calls fetchConfigurations when component mounts but not when it unmounts", async () => {
|
|
40
|
+
const fetchConfigurationsMock = jest.fn();
|
|
44
41
|
const props = {
|
|
45
42
|
clearConfigurations,
|
|
46
|
-
fetchConfigurations,
|
|
47
|
-
configurationsLoading
|
|
43
|
+
fetchConfigurations: fetchConfigurationsMock,
|
|
44
|
+
configurationsLoading: false,
|
|
48
45
|
};
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
const rendered = render(<ConfigurationsLoader {...props} />);
|
|
47
|
+
await waitForLoad(rendered);
|
|
48
|
+
expect(fetchConfigurationsMock).toHaveBeenCalledTimes(1);
|
|
49
|
+
rendered.unmount();
|
|
50
|
+
expect(fetchConfigurationsMock).toHaveBeenCalledTimes(1);
|
|
53
51
|
});
|
|
54
52
|
|
|
55
|
-
it("calls clearConfigurations when component unmounts but not when it mounts", () => {
|
|
56
|
-
const
|
|
53
|
+
it("calls clearConfigurations when component unmounts but not when it mounts", async () => {
|
|
54
|
+
const clearConfigurationsMock = jest.fn();
|
|
57
55
|
const props = {
|
|
58
|
-
clearConfigurations,
|
|
56
|
+
clearConfigurations: clearConfigurationsMock,
|
|
59
57
|
fetchConfigurations,
|
|
60
|
-
configurationsLoading
|
|
58
|
+
configurationsLoading: false,
|
|
61
59
|
};
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
const rendered = render(<ConfigurationsLoader {...props} />);
|
|
61
|
+
await waitForLoad(rendered);
|
|
62
|
+
expect(clearConfigurationsMock).not.toHaveBeenCalled();
|
|
63
|
+
rendered.unmount();
|
|
64
|
+
expect(clearConfigurationsMock).toHaveBeenCalledTimes(1);
|
|
66
65
|
});
|
|
67
66
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import EditConfiguration from "../EditConfiguration";
|
|
4
3
|
|
|
5
4
|
const renderOpts = {
|
|
@@ -14,8 +13,9 @@ const renderOpts = {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
describe("<EditConfiguration />", () => {
|
|
17
|
-
it("matches the latest snapshot", () => {
|
|
18
|
-
const
|
|
19
|
-
|
|
16
|
+
it("matches the latest snapshot", async () => {
|
|
17
|
+
const rendered = render(<EditConfiguration />, renderOpts);
|
|
18
|
+
await waitForLoad(rendered);
|
|
19
|
+
expect(rendered.container).toMatchSnapshot();
|
|
20
20
|
});
|
|
21
21
|
});
|
|
@@ -1,68 +1,133 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Configuration /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui breadcrumb"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
class="section"
|
|
10
|
+
data-discover="true"
|
|
11
|
+
href="/configurations"
|
|
12
|
+
>
|
|
13
|
+
navigation.admin.configurations
|
|
14
|
+
</a>
|
|
15
|
+
<i
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
class="right angle icon divider"
|
|
18
|
+
/>
|
|
19
|
+
<div
|
|
20
|
+
class="active section"
|
|
21
|
+
>
|
|
22
|
+
Micro1
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
class="ui segment"
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
class="ui grid"
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
class="eight wide column"
|
|
12
33
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
34
|
+
<h2
|
|
35
|
+
class="ui header"
|
|
15
36
|
>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
circular
|
|
19
|
-
name="clipboard check"
|
|
37
|
+
<i
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
class="clipboard check circular icon"
|
|
20
40
|
/>
|
|
21
|
-
<
|
|
41
|
+
<div
|
|
42
|
+
class="content"
|
|
43
|
+
>
|
|
22
44
|
Micro1
|
|
23
|
-
<
|
|
45
|
+
<div
|
|
46
|
+
class="sub header"
|
|
47
|
+
>
|
|
24
48
|
micro
|
|
25
|
-
</
|
|
26
|
-
</
|
|
27
|
-
</
|
|
28
|
-
</
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
width={8}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</h2>
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
class="right aligned eight wide column"
|
|
32
55
|
>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
56
|
+
<div
|
|
57
|
+
aria-expanded="false"
|
|
58
|
+
class="ui floating dropdown button icon group-actions"
|
|
59
|
+
role="listbox"
|
|
60
|
+
tabindex="0"
|
|
61
|
+
>
|
|
62
|
+
<i
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
class="ellipsis vertical icon"
|
|
65
|
+
/>
|
|
66
|
+
<div
|
|
67
|
+
class="left menu transition"
|
|
68
|
+
>
|
|
69
|
+
<a
|
|
70
|
+
aria-checked="false"
|
|
71
|
+
aria-selected="false"
|
|
72
|
+
class="item"
|
|
73
|
+
data-discover="true"
|
|
74
|
+
href="/configurations/Micro1/edit"
|
|
75
|
+
role="option"
|
|
76
|
+
style="pointer-events: all;"
|
|
77
|
+
>
|
|
78
|
+
<i
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
class="edit icon"
|
|
81
|
+
/>
|
|
82
|
+
edit
|
|
83
|
+
</a>
|
|
84
|
+
<button
|
|
85
|
+
class="ui button"
|
|
86
|
+
>
|
|
87
|
+
<i
|
|
88
|
+
aria-hidden="true"
|
|
89
|
+
class="red trash alternate outline icon"
|
|
90
|
+
/>
|
|
91
|
+
configurations.actions.remove
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
class="eight wide column"
|
|
37
98
|
>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</
|
|
99
|
+
<div
|
|
100
|
+
class="ui horizontal divider"
|
|
101
|
+
>
|
|
102
|
+
<h3>
|
|
103
|
+
New Group 1
|
|
104
|
+
</h3>
|
|
105
|
+
</div>
|
|
106
|
+
<div
|
|
107
|
+
class="ui big very relaxed list"
|
|
108
|
+
role="list"
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
class="item"
|
|
112
|
+
role="listitem"
|
|
113
|
+
>
|
|
114
|
+
<div
|
|
115
|
+
class="header dynamic-field-header"
|
|
116
|
+
>
|
|
117
|
+
a
|
|
118
|
+
</div>
|
|
119
|
+
<div
|
|
120
|
+
class="description"
|
|
121
|
+
>
|
|
122
|
+
<i
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
class="grey minus icon"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
68
133
|
`;
|