@truedat/qx 7.5.9 → 7.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +45 -64
- package/src/components/QxRoutes.js +38 -19
- package/src/components/__tests__/QxRoutes.spec.js +73 -0
- package/src/components/__tests__/__snapshots__/QxRoutes.spec.js.snap +60 -0
- package/src/components/common/ClauseViewer.js +6 -6
- package/src/components/common/DescriptionInput.js +0 -1
- package/src/components/common/ResourceSelector.js +2 -3
- package/src/components/common/TestFormWrapper.js +2 -13
- package/src/components/common/TypeSelector.js +0 -1
- package/src/components/common/__tests__/DescriptionInput.spec.js +12 -21
- package/src/components/common/__tests__/ResourceSelector.spec.js +42 -87
- package/src/components/common/__tests__/TypeSelector.spec.js +0 -1
- package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +32 -22
- package/src/components/common/expressions/Clauses.js +5 -6
- package/src/components/common/expressions/Condition.js +8 -9
- package/src/components/common/expressions/ConstantSelector.js +2 -2
- package/src/components/common/expressions/Expression.js +2 -2
- package/src/components/common/expressions/FieldSelector.js +2 -2
- package/src/components/common/expressions/FunctionArgs.js +5 -6
- package/src/components/common/expressions/FunctionSelector.js +2 -2
- package/src/components/common/expressions/ParamSelector.js +2 -2
- package/src/components/common/expressions/ShapeSelector.js +7 -16
- package/src/components/common/expressions/__tests__/Clauses.spec.js +10 -9
- package/src/components/common/expressions/__tests__/Condition.spec.js +6 -26
- package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +14 -30
- package/src/components/common/expressions/__tests__/Expression.spec.js +44 -51
- package/src/components/common/expressions/__tests__/FieldSelector.spec.js +2 -7
- package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +18 -44
- package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +19 -27
- package/src/components/common/expressions/__tests__/ParamSelector.spec.js +28 -58
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +42 -43
- package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +6 -6
- package/src/components/common/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap +6 -7
- package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +20 -20
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +8 -9
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +670 -8
- package/src/components/common/expressions/__tests__/__snapshots__/ParamSelector.spec.js.snap +5 -5
- package/src/components/common/expressions/__tests__/__snapshots__/ShapeSelector.spec.js.snap +9 -9
- package/src/components/common/expressions/__tests__/useWatchParams.spec.js +1 -4
- package/src/components/common/expressions/constantInputs/AnySelector.js +5 -6
- package/src/components/common/expressions/constantInputs/BooleanSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/DefaultSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +16 -37
- package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +14 -17
- package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +12 -27
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/AnySelector.spec.js.snap +11 -11
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/DefaultSelector.spec.js.snap +0 -1
- package/src/components/common/resourceSelectors/DataStructureSelector.js +2 -2
- package/src/components/common/resourceSelectors/DataViewSelector.js +2 -2
- package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +2 -2
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +5 -29
- package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +23 -25
- package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +21 -32
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +3 -4
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataViewSelector.spec.js.snap +1 -1
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/ReferenceDatasetSelector.spec.js.snap +1 -1
- package/src/components/dataViews/DataViewEditor.js +5 -6
- package/src/components/dataViews/DataViewSelect.js +4 -5
- package/src/components/dataViews/DataViews.js +1 -2
- package/src/components/dataViews/Queryable.js +4 -4
- package/src/components/dataViews/Queryables.js +0 -1
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +36 -111
- package/src/components/dataViews/__tests__/DataViewSelect.spec.js +0 -1
- package/src/components/dataViews/__tests__/DataViews.spec.js +15 -16
- package/src/components/dataViews/__tests__/Queryable.spec.js +0 -1
- package/src/components/dataViews/__tests__/Queryables.spec.js +35 -74
- package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +61 -55
- package/src/components/dataViews/__tests__/__snapshots__/DataViews.spec.js.snap +5 -5
- package/src/components/dataViews/__tests__/__snapshots__/Queryables.spec.js.snap +59 -59
- package/src/components/dataViews/queryableProperties/From.js +4 -4
- package/src/components/dataViews/queryableProperties/GroupBy.js +6 -6
- package/src/components/dataViews/queryableProperties/Join.js +6 -6
- package/src/components/dataViews/queryableProperties/JoinTypeIcon.js +8 -9
- package/src/components/dataViews/queryableProperties/Select.js +4 -5
- package/src/components/dataViews/queryableProperties/SelectField.js +4 -4
- package/src/components/dataViews/queryableProperties/Where.js +4 -4
- package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +16 -42
- package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +6 -29
- package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +26 -50
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +22 -42
- package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +6 -17
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +309 -9
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Join.spec.js.snap +12 -12
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Select.spec.js.snap +192 -18
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/SelectField.spec.js.snap +6 -8
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Where.spec.js.snap +2 -2
- package/src/components/functions/FunctionEditor.js +3 -5
- package/src/components/functions/FunctionParams.js +2 -3
- package/src/components/functions/Functions.js +3 -4
- package/src/components/functions/__tests__/FunctionEditor.spec.js +61 -57
- package/src/components/functions/__tests__/FunctionParams.spec.js +50 -47
- package/src/components/functions/__tests__/Functions.spec.js +5 -12
- package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +11 -11
- package/src/components/functions/__tests__/__snapshots__/Functions.spec.js.snap +4 -5
- package/src/components/qualityControls/ControlProperties.js +4 -4
- package/src/components/qualityControls/ControlPropertiesView.js +0 -1
- package/src/components/qualityControls/EditQualityControl.js +5 -5
- package/src/components/qualityControls/IconPopup.js +0 -1
- package/src/components/qualityControls/NewDraftQualityControl.js +8 -6
- package/src/components/qualityControls/NewQualityControl.js +5 -6
- package/src/components/qualityControls/QualityBadge.js +29 -30
- package/src/components/qualityControls/QualityControl.js +4 -7
- package/src/components/qualityControls/QualityControlActions.js +7 -7
- package/src/components/qualityControls/QualityControlCrumbs.js +1 -3
- package/src/components/qualityControls/QualityControlEditor.js +5 -11
- package/src/components/qualityControls/QualityControlHeader.js +4 -6
- package/src/components/qualityControls/QualityControlHistory.js +3 -3
- package/src/components/qualityControls/QualityControlManageDomain.js +2 -2
- package/src/components/qualityControls/QualityControlQueryModal.js +1 -1
- package/src/components/qualityControls/QualityControlRoutes.js +27 -54
- package/src/components/qualityControls/QualityControlRow.js +0 -2
- package/src/components/qualityControls/QualityControlScores.js +7 -5
- package/src/components/qualityControls/QualityControlTabs.js +2 -2
- package/src/components/qualityControls/QualityControls.js +10 -8
- package/src/components/qualityControls/QualityControlsLabelResults.js +0 -2
- package/src/components/qualityControls/QualityControlsPagination.js +0 -1
- package/src/components/qualityControls/QualityControlsTable.js +1 -2
- package/src/components/qualityControls/ScoreCriteria.js +4 -4
- package/src/components/qualityControls/ScoreCriteriaView.js +0 -1
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +10 -15
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +0 -1
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +28 -70
- package/src/components/qualityControls/__tests__/IconPopup.spec.js +10 -11
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +33 -70
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +81 -113
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +50 -58
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +19 -31
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +49 -46
- package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +68 -107
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +22 -25
- package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +6 -6
- package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +12 -11
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -8
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +23 -19
- package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +2 -3
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +69 -53
- package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +2 -3
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +0 -1
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +0 -1
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +32 -34
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +31 -33
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +17 -19
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +9 -15
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +5 -4
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlCrumbs.spec.js.snap +1 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +0 -3
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +16 -11
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +2 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +2 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +11 -21
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +2 -0
- package/src/components/qualityControls/controlProperties/Count.js +5 -5
- package/src/components/qualityControls/controlProperties/Ratio.js +6 -8
- package/src/components/qualityControls/controlProperties/__tests__/Count.spec.js +6 -11
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +9 -27
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +10 -10
- package/src/components/qualityControls/qualityByControlMode.js +14 -14
- package/src/components/qualityControls/qualityControlScoresColumns.js +1 -2
- package/src/components/qualityControls/scoreCriterias/Deviation.js +2 -2
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +3 -4
- package/src/components/qualityControls/scoreCriterias/Percentage.js +2 -2
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +0 -1
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +39 -43
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +23 -19
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/ErrorCount.spec.js.snap +4 -7
- package/src/components/scores/MyScoreGroups.js +0 -1
- package/src/components/scores/QualityBar.js +24 -22
- package/src/components/scores/Score.js +4 -5
- package/src/components/scores/ScoreCrumbs.js +3 -5
- package/src/components/scores/ScoreDetails.js +2 -2
- package/src/components/scores/ScoreEvents.js +2 -2
- package/src/components/scores/ScoreGroup.js +5 -4
- package/src/components/scores/ScoreGroupBreadcrumbs.js +1 -2
- package/src/components/scores/ScoreGroupForm.js +2 -4
- package/src/components/scores/ScoreGroupLink.js +1 -2
- package/src/components/scores/ScoreGroupMessage.js +0 -1
- package/src/components/scores/ScoreGroupPopup.js +1 -1
- package/src/components/scores/ScoreGroupsRoutes.js +19 -0
- package/src/components/scores/ScoreGroupsTable.js +15 -48
- package/src/components/scores/ScoreRoutes.js +9 -24
- package/src/components/scores/ScoreStatusDecorator.js +1 -2
- package/src/components/scores/ScoreTabs.js +2 -2
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +0 -1
- package/src/components/scores/__tests__/QualityBar.spec.js +19 -26
- package/src/components/scores/__tests__/Score.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreCrumbs.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreDetails.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreEvents.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreGroup.spec.js +15 -14
- package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupForm.spec.js +18 -34
- package/src/components/scores/__tests__/ScoreGroupLink.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +0 -2
- package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +32 -0
- package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreTabs.spec.js +3 -4
- package/src/components/scores/__tests__/__snapshots__/MyScoreGroups.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +4 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreDetails.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +39 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupBreadcrumbs.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupForm.spec.js.snap +10 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupLink.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsRoutes.spec.js.snap +19 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsTable.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreStatusDecorator.spec.js.snap +5 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreTabs.spec.js.snap +4 -0
- package/src/hooks/__tests__/useDataViews.spec.js +1 -1
- package/src/hooks/__tests__/useFunctions.spec.js +5 -5
- package/src/hooks/useDataViews.js +2 -2
- package/src/hooks/useExecutionGroups.js +1 -1
- package/src/hooks/useFunctions.js +4 -4
- package/src/hooks/useQualityControls.js +13 -7
- package/src/hooks/useScoreGroups.js +1 -1
- package/src/hooks/useScores.js +2 -2
- package/src/styles/scores.less +21 -21
- package/src/types.js +1 -4
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import { waitFor } from "@testing-library/react";
|
|
4
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
|
+
import { singleTemplateMock } from "@truedat/test/mocks";
|
|
5
|
+
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
5
6
|
import { SOURCE_OPTIONS_QUERY } from "@truedat/cx/sources/api/queries";
|
|
6
7
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
7
|
-
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
8
|
-
import { singleTemplateMock } from "@truedat/test/mocks";
|
|
9
8
|
import {
|
|
10
9
|
useQualityControlUpdateDraft,
|
|
11
10
|
useQualityControl,
|
|
12
11
|
} from "@truedat/qx/hooks/useQualityControls";
|
|
13
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
14
12
|
import EditQualityControl from "../EditQualityControl";
|
|
15
13
|
import {
|
|
16
14
|
sources,
|
|
@@ -18,12 +16,12 @@ import {
|
|
|
18
16
|
qualityControlData,
|
|
19
17
|
} from "./__fixtures__/qualityControlHelper";
|
|
20
18
|
|
|
21
|
-
const
|
|
19
|
+
const mockNavigate = jest.fn();
|
|
22
20
|
|
|
23
|
-
jest.mock("react-router
|
|
24
|
-
...jest.requireActual("react-router
|
|
21
|
+
jest.mock("react-router", () => ({
|
|
22
|
+
...jest.requireActual("react-router"),
|
|
25
23
|
useParams: () => ({ id: "8", version: "1" }),
|
|
26
|
-
|
|
24
|
+
useNavigate: () => mockNavigate,
|
|
27
25
|
}));
|
|
28
26
|
|
|
29
27
|
jest.mock("@truedat/qx/hooks/useQualityControls", () => {
|
|
@@ -49,17 +47,7 @@ jest.mock("@truedat/qx/hooks/useQualityControls", () => {
|
|
|
49
47
|
};
|
|
50
48
|
});
|
|
51
49
|
|
|
52
|
-
jest.mock("@truedat/core/hooks/useUserFilters"
|
|
53
|
-
const originalModule = jest.requireActual(
|
|
54
|
-
"@truedat/core/hooks/useUserFilters"
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
__esModule: true,
|
|
59
|
-
...originalModule,
|
|
60
|
-
useUserFilters: jest.fn(() => ({})),
|
|
61
|
-
};
|
|
62
|
-
});
|
|
50
|
+
jest.mock("@truedat/core/hooks/useUserFilters");
|
|
63
51
|
jest.mock("@truedat/qx/hooks/useFunctions", () => {
|
|
64
52
|
const originalModule = jest.requireActual("@truedat/qx/hooks/useFunctions");
|
|
65
53
|
|
|
@@ -124,23 +112,13 @@ const renderOpts = {
|
|
|
124
112
|
publishDomainsMock,
|
|
125
113
|
createDomainsMock,
|
|
126
114
|
],
|
|
127
|
-
messages,
|
|
128
|
-
fallback: "loading",
|
|
129
115
|
};
|
|
130
116
|
|
|
131
117
|
describe("<EditQualityControl />", () => {
|
|
132
118
|
it("matches the latest snapshot", async () => {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
);
|
|
137
|
-
await waitFor(() =>
|
|
138
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
139
|
-
);
|
|
140
|
-
await waitFor(() =>
|
|
141
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
142
|
-
);
|
|
143
|
-
expect(container).toMatchSnapshot();
|
|
119
|
+
const rendered = render(<EditQualityControl />, renderOpts);
|
|
120
|
+
await waitForLoad(rendered);
|
|
121
|
+
expect(rendered.container).toMatchSnapshot();
|
|
144
122
|
});
|
|
145
123
|
|
|
146
124
|
it("matches the latest snapshot with empty qualityControl", async () => {
|
|
@@ -149,34 +127,18 @@ describe("<EditQualityControl />", () => {
|
|
|
149
127
|
loading: false,
|
|
150
128
|
}));
|
|
151
129
|
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
);
|
|
156
|
-
await waitFor(() =>
|
|
157
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
158
|
-
);
|
|
159
|
-
await waitFor(() =>
|
|
160
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
161
|
-
);
|
|
162
|
-
expect(container).toMatchSnapshot();
|
|
130
|
+
const rendered = render(<EditQualityControl />, renderOpts);
|
|
131
|
+
await waitForLoad(rendered);
|
|
132
|
+
expect(rendered.container).toMatchSnapshot();
|
|
163
133
|
});
|
|
164
134
|
|
|
165
|
-
it("navigates to
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
170
|
-
await waitFor(() =>
|
|
171
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
172
|
-
);
|
|
173
|
-
await waitFor(() =>
|
|
174
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
175
|
-
);
|
|
176
|
-
userEvent.click(getByText(/Cancel/));
|
|
135
|
+
it("navigates to quality controls when cancel button is cliked", async () => {
|
|
136
|
+
const rendered = render(<EditQualityControl />, renderOpts);
|
|
137
|
+
await waitForLoad(rendered);
|
|
138
|
+
const user = userEvent.setup({ delay: null });
|
|
139
|
+
await user.click(rendered.getByText(/cancel/i));
|
|
177
140
|
|
|
178
|
-
expect(
|
|
179
|
-
expect(mockHistory.push.mock.calls[0][0]).toBe("/qualityControls");
|
|
141
|
+
expect(mockNavigate).toHaveBeenCalledWith("/qualityControls");
|
|
180
142
|
});
|
|
181
143
|
|
|
182
144
|
it("test save submit ", async () => {
|
|
@@ -188,24 +150,20 @@ describe("<EditQualityControl />", () => {
|
|
|
188
150
|
trigger,
|
|
189
151
|
}));
|
|
190
152
|
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
renderOpts
|
|
194
|
-
);
|
|
153
|
+
const rendered = render(<EditQualityControl />, renderOpts);
|
|
154
|
+
await waitForLoad(rendered);
|
|
195
155
|
|
|
196
156
|
await waitFor(() =>
|
|
197
|
-
expect(
|
|
198
|
-
);
|
|
199
|
-
await waitFor(() =>
|
|
200
|
-
expect(getByRole("button", { name: /Save/ })).toBeDisabled()
|
|
157
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
201
158
|
);
|
|
202
159
|
|
|
203
|
-
userEvent.
|
|
160
|
+
const user = userEvent.setup({ delay: null });
|
|
161
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "_modified");
|
|
204
162
|
|
|
205
163
|
await waitFor(() =>
|
|
206
|
-
expect(getByRole("button", { name: /
|
|
164
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeEnabled()
|
|
207
165
|
);
|
|
208
|
-
|
|
166
|
+
await user.click(rendered.getByText(/save/i));
|
|
209
167
|
|
|
210
168
|
const qualityControl = qualityControlData({
|
|
211
169
|
versions: [],
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
1
|
import { fireEvent } from "@testing-library/react";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
3
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
5
4
|
import IconPopup from "../IconPopup";
|
|
6
5
|
|
|
@@ -15,19 +14,19 @@ const props = {
|
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
describe("<IconPopup />", () => {
|
|
18
|
-
it("matches the latest snapshot", () => {
|
|
19
|
-
const
|
|
20
|
-
|
|
17
|
+
it("matches the latest snapshot", async () => {
|
|
18
|
+
const rendered = render(<IconPopup {...props} />, renderOpts);
|
|
19
|
+
await waitForLoad(rendered);
|
|
20
|
+
expect(rendered.container).toMatchSnapshot();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
it("show popup information with mouse over", async () => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
const icon = container.querySelector(".red.circle.icon");
|
|
24
|
+
const rendered = render(<IconPopup {...props} />, renderOpts);
|
|
25
|
+
await waitForLoad(rendered);
|
|
26
|
+
|
|
27
|
+
const icon = rendered.container.querySelector(".red.circle.icon");
|
|
29
28
|
fireEvent.mouseOver(icon);
|
|
30
29
|
|
|
31
|
-
expect(await findByText(
|
|
30
|
+
expect(await rendered.findByText(/result criteria/i)).toBeInTheDocument();
|
|
32
31
|
});
|
|
33
32
|
});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import { waitFor } from "@testing-library/react";
|
|
4
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import { QUALITY_CONTROLS } from "@truedat/core/routes";
|
|
6
5
|
import { SOURCE_OPTIONS_QUERY } from "@truedat/cx/sources/api/queries";
|
|
7
6
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
8
7
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
9
8
|
import { singleTemplateMock } from "@truedat/test/mocks";
|
|
10
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
11
9
|
import {
|
|
12
10
|
useQualityControlCreateDraft,
|
|
13
11
|
useQualityControl,
|
|
@@ -19,25 +17,15 @@ import {
|
|
|
19
17
|
qualityControlData,
|
|
20
18
|
} from "./__fixtures__/qualityControlHelper";
|
|
21
19
|
|
|
22
|
-
const
|
|
20
|
+
const mockNavigate = jest.fn();
|
|
23
21
|
|
|
24
|
-
jest.mock("react-router
|
|
25
|
-
...jest.requireActual("react-router
|
|
22
|
+
jest.mock("react-router", () => ({
|
|
23
|
+
...jest.requireActual("react-router"),
|
|
26
24
|
useParams: () => ({ id: "8", version: "1" }),
|
|
27
|
-
|
|
25
|
+
useNavigate: () => mockNavigate,
|
|
28
26
|
}));
|
|
29
27
|
|
|
30
|
-
jest.mock("@truedat/core/hooks/useUserFilters"
|
|
31
|
-
const originalModule = jest.requireActual(
|
|
32
|
-
"@truedat/core/hooks/useUserFilters"
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
__esModule: true,
|
|
37
|
-
...originalModule,
|
|
38
|
-
useUserFilters: jest.fn(() => ({})),
|
|
39
|
-
};
|
|
40
|
-
});
|
|
28
|
+
jest.mock("@truedat/core/hooks/useUserFilters");
|
|
41
29
|
jest.mock("@truedat/qx/hooks/useFunctions", () => {
|
|
42
30
|
const originalModule = jest.requireActual("@truedat/qx/hooks/useFunctions");
|
|
43
31
|
|
|
@@ -125,42 +113,26 @@ const renderOpts = {
|
|
|
125
113
|
publishDomainsMock,
|
|
126
114
|
createDomainsMock,
|
|
127
115
|
],
|
|
128
|
-
messages,
|
|
129
|
-
fallback: "loading",
|
|
130
116
|
};
|
|
131
117
|
|
|
132
118
|
describe("<NewDraftQualityControl />", () => {
|
|
133
119
|
it("matches the latest snapshot", async () => {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
await waitFor(() =>
|
|
140
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
141
|
-
);
|
|
142
|
-
await waitFor(() =>
|
|
143
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
144
|
-
);
|
|
145
|
-
expect(container).toMatchSnapshot();
|
|
120
|
+
const rendered = render(<NewDraftQualityControl />, renderOpts);
|
|
121
|
+
await waitForLoad(rendered);
|
|
122
|
+
expect(rendered.container).toMatchSnapshot();
|
|
146
123
|
});
|
|
147
124
|
|
|
148
125
|
it("navigates to quality controls when cancel button is cliked", async () => {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
renderOpts
|
|
152
|
-
);
|
|
153
|
-
await waitFor(() =>
|
|
154
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
155
|
-
);
|
|
126
|
+
const rendered = render(<NewDraftQualityControl />, renderOpts);
|
|
127
|
+
await waitForLoad(rendered);
|
|
156
128
|
|
|
157
|
-
const cancelButton = getByText(/
|
|
129
|
+
const cancelButton = rendered.getByText(/cancel/i);
|
|
158
130
|
expect(cancelButton).toBeInTheDocument();
|
|
159
131
|
|
|
160
|
-
userEvent.
|
|
132
|
+
const user = userEvent.setup({ delay: null });
|
|
133
|
+
await user.click(cancelButton);
|
|
161
134
|
|
|
162
|
-
expect(
|
|
163
|
-
expect(mockHistory.push.mock.calls[0][0]).toBe(QUALITY_CONTROLS);
|
|
135
|
+
expect(mockNavigate).toHaveBeenCalledWith(QUALITY_CONTROLS);
|
|
164
136
|
});
|
|
165
137
|
|
|
166
138
|
it("test save submit ", async () => {
|
|
@@ -172,24 +144,20 @@ describe("<NewDraftQualityControl />", () => {
|
|
|
172
144
|
trigger,
|
|
173
145
|
}));
|
|
174
146
|
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
renderOpts
|
|
178
|
-
);
|
|
147
|
+
const rendered = render(<NewDraftQualityControl />, renderOpts);
|
|
148
|
+
await waitForLoad(rendered);
|
|
179
149
|
|
|
180
150
|
await waitFor(() =>
|
|
181
|
-
expect(
|
|
182
|
-
);
|
|
183
|
-
await waitFor(() =>
|
|
184
|
-
expect(getByRole("button", { name: /Save/ })).toBeDisabled()
|
|
151
|
+
expect(rendered.getByRole("button", { name: /save/ })).toBeDisabled()
|
|
185
152
|
);
|
|
186
153
|
|
|
187
|
-
userEvent.
|
|
154
|
+
const user = userEvent.setup({ delay: null });
|
|
155
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "_modified");
|
|
188
156
|
|
|
189
157
|
await waitFor(() =>
|
|
190
|
-
expect(getByRole("button", { name: /
|
|
158
|
+
expect(rendered.getByRole("button", { name: /save/ })).toBeEnabled()
|
|
191
159
|
);
|
|
192
|
-
|
|
160
|
+
await user.click(rendered.getByText(/save/i));
|
|
193
161
|
|
|
194
162
|
const qualityControl = qualityControlData({
|
|
195
163
|
versions: [],
|
|
@@ -210,24 +178,20 @@ describe("<NewDraftQualityControl />", () => {
|
|
|
210
178
|
trigger,
|
|
211
179
|
}));
|
|
212
180
|
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
renderOpts
|
|
216
|
-
);
|
|
181
|
+
const rendered = render(<NewDraftQualityControl />, renderOpts);
|
|
182
|
+
await waitForLoad(rendered);
|
|
217
183
|
|
|
218
184
|
await waitFor(() =>
|
|
219
|
-
expect(
|
|
220
|
-
);
|
|
221
|
-
await waitFor(() =>
|
|
222
|
-
expect(getByRole("button", { name: /Publish/ })).toBeDisabled()
|
|
185
|
+
expect(rendered.getByRole("button", { name: /publish/ })).toBeDisabled()
|
|
223
186
|
);
|
|
224
187
|
|
|
225
|
-
userEvent.
|
|
188
|
+
const user = userEvent.setup({ delay: null });
|
|
189
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "_modified");
|
|
226
190
|
|
|
227
191
|
await waitFor(() =>
|
|
228
|
-
expect(getByRole("button", { name: /
|
|
192
|
+
expect(rendered.getByRole("button", { name: /publish/ })).toBeEnabled()
|
|
229
193
|
);
|
|
230
|
-
|
|
194
|
+
await user.click(rendered.getByText(/publish/i));
|
|
231
195
|
|
|
232
196
|
const qualityControl = qualityControlData({
|
|
233
197
|
versions: [],
|
|
@@ -242,12 +206,11 @@ describe("<NewDraftQualityControl />", () => {
|
|
|
242
206
|
it("when no quality control is fetched, do not render editor", async () => {
|
|
243
207
|
useQualityControl.mockImplementation(() => ({ data: undefined }));
|
|
244
208
|
|
|
245
|
-
const
|
|
209
|
+
const rendered = render(<NewDraftQualityControl />, renderOpts);
|
|
210
|
+
await waitForLoad(rendered);
|
|
246
211
|
|
|
247
212
|
await waitFor(() =>
|
|
248
|
-
expect(queryByText(/
|
|
213
|
+
expect(rendered.queryByText(/save/i)).not.toBeInTheDocument()
|
|
249
214
|
);
|
|
250
|
-
|
|
251
|
-
await waitFor(() => expect(queryByText(/Save/i)).not.toBeInTheDocument());
|
|
252
215
|
});
|
|
253
216
|
});
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import { waitFor } from "@testing-library/react";
|
|
4
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { act, waitFor } from "@testing-library/react";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import { singleTemplateMock } from "@truedat/test/mocks";
|
|
6
5
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
7
6
|
import { SOURCE_OPTIONS_QUERY } from "@truedat/cx/sources/api/queries";
|
|
8
7
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
9
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
10
8
|
import { useQualityControlCreate } from "@truedat/qx/hooks/useQualityControls";
|
|
11
9
|
import NewQualityControl from "../NewQualityControl";
|
|
12
10
|
import { sources, domains } from "./__fixtures__/qualityControlHelper";
|
|
13
11
|
|
|
14
|
-
const
|
|
12
|
+
const mockNavigate = jest.fn();
|
|
15
13
|
|
|
16
|
-
jest.mock("react-router
|
|
17
|
-
...jest.requireActual("react-router
|
|
18
|
-
|
|
14
|
+
jest.mock("react-router", () => ({
|
|
15
|
+
...jest.requireActual("react-router"),
|
|
16
|
+
useNavigate: () => mockNavigate,
|
|
19
17
|
}));
|
|
20
18
|
|
|
21
19
|
jest.mock("@truedat/qx/hooks/useQualityControls", () => ({
|
|
@@ -100,45 +98,29 @@ const renderOpts = {
|
|
|
100
98
|
createDomainsMock,
|
|
101
99
|
domainsMock,
|
|
102
100
|
],
|
|
103
|
-
messages,
|
|
104
|
-
fallback: "loading",
|
|
105
101
|
};
|
|
106
102
|
|
|
107
103
|
describe("<NewQualityControl />", () => {
|
|
108
104
|
it("matches the latest snapshot", async () => {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
renderOpts
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
await waitFor(() =>
|
|
116
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
117
|
-
);
|
|
118
|
-
await waitFor(() =>
|
|
119
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
120
|
-
);
|
|
121
|
-
expect(container).toMatchSnapshot();
|
|
105
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
106
|
+
await waitForLoad(rendered);
|
|
107
|
+
expect(rendered.container).toMatchSnapshot();
|
|
122
108
|
});
|
|
123
109
|
|
|
124
110
|
it("navigates to qulity controls when cancel button is cliked", async () => {
|
|
125
|
-
const {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
await
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
await waitFor(() =>
|
|
133
|
-
|
|
134
|
-
);
|
|
135
|
-
userEvent.click(getByText(/Cancel/));
|
|
136
|
-
userEvent.click(getByText(/confirm_yes/));
|
|
137
|
-
await waitFor(() => expect(mockHistory.push.mock.calls.length).toBe(1));
|
|
138
|
-
expect(mockHistory.push.mock.calls[0][0]).toBe("/qualityControls");
|
|
111
|
+
const user = userEvent.setup({ delay: null });
|
|
112
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
113
|
+
await waitForLoad(rendered);
|
|
114
|
+
|
|
115
|
+
await user.click(rendered.getByText(/actions.cancel/i));
|
|
116
|
+
await user.click(rendered.getByText(/confirmation.yes/i));
|
|
117
|
+
|
|
118
|
+
await waitFor(() => expect(mockNavigate.mock.calls.length).toBe(1));
|
|
119
|
+
expect(mockNavigate.mock.calls[0][0]).toBe("/qualityControls");
|
|
139
120
|
});
|
|
140
121
|
|
|
141
122
|
it("test save submit ", async () => {
|
|
123
|
+
const user = userEvent.setup({ delay: null });
|
|
142
124
|
const trigger = jest.fn(() =>
|
|
143
125
|
Promise.resolve({ data: { data: { id: "9", version: "1" } } })
|
|
144
126
|
);
|
|
@@ -147,69 +129,59 @@ describe("<NewQualityControl />", () => {
|
|
|
147
129
|
trigger,
|
|
148
130
|
}));
|
|
149
131
|
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
getByText,
|
|
153
|
-
getByPlaceholderText,
|
|
154
|
-
queryByText,
|
|
155
|
-
getByRole,
|
|
156
|
-
getAllByRole,
|
|
157
|
-
} = render(<NewQualityControl />, renderOpts);
|
|
132
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
133
|
+
await waitForLoad(rendered);
|
|
158
134
|
|
|
159
135
|
await waitFor(() =>
|
|
160
|
-
expect(
|
|
161
|
-
);
|
|
162
|
-
await waitFor(() =>
|
|
163
|
-
expect(getByRole("button", { name: /Save/ })).toBeDisabled()
|
|
136
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
164
137
|
);
|
|
165
138
|
|
|
166
|
-
// Fill in the 'Name' field
|
|
167
|
-
userEvent.type(getByPlaceholderText("Name"), "test_modified");
|
|
168
|
-
|
|
169
139
|
// Select a domain
|
|
170
|
-
|
|
171
|
-
|
|
140
|
+
await user.click(rendered.getByText(/domain.multiple.placeholder/i));
|
|
141
|
+
await user.click(rendered.getByText(/bardomain/i));
|
|
142
|
+
|
|
143
|
+
// Fill in the 'Name' field
|
|
144
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "test_modified");
|
|
172
145
|
|
|
173
146
|
// Select a source
|
|
174
|
-
|
|
175
|
-
|
|
147
|
+
await user.click(rendered.getByText(/source.search.placeholder/i));
|
|
148
|
+
await user.click(
|
|
149
|
+
rendered.getByRole("option", { name: /external_source_id/i })
|
|
150
|
+
);
|
|
176
151
|
|
|
177
152
|
// Select a control mode
|
|
178
|
-
|
|
153
|
+
await user.click(
|
|
154
|
+
rendered.getByRole("option", { name: /control_mode.percentage/i })
|
|
155
|
+
);
|
|
179
156
|
|
|
180
157
|
// Fill in the 'Threshold' field
|
|
181
|
-
|
|
158
|
+
await user.type(
|
|
159
|
+
rendered.getByPlaceholderText(/score_criteria.percentage.minimum/i),
|
|
160
|
+
"10"
|
|
161
|
+
);
|
|
182
162
|
|
|
183
163
|
// Fill in the 'Goal' field
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
188
|
-
);
|
|
189
|
-
await waitFor(() =>
|
|
190
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
164
|
+
await user.type(
|
|
165
|
+
rendered.getByPlaceholderText(/score_criteria.percentage.goal/i),
|
|
166
|
+
"20"
|
|
191
167
|
);
|
|
192
168
|
|
|
193
|
-
|
|
194
|
-
userEvent.click(getByText(/Resource type/));
|
|
195
|
-
userEvent.click(getByText(/Reference datasets/));
|
|
196
|
-
userEvent.click(getByRole("option", { name: /dataset1/i }));
|
|
169
|
+
await waitForLoad(rendered);
|
|
197
170
|
|
|
198
|
-
await
|
|
199
|
-
|
|
200
|
-
);
|
|
201
|
-
await waitFor(() =>
|
|
202
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
203
|
-
);
|
|
171
|
+
await user.click(rendered.getByText(/^queryables.resource.type$/));
|
|
172
|
+
await user.click(rendered.getByText(/reference_dataset/i));
|
|
173
|
+
await user.click(rendered.getByRole("option", { name: /dataset1/i }));
|
|
204
174
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
175
|
+
await act(async () => {
|
|
176
|
+
await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
|
|
177
|
+
await user.click(rendered.getByRole("option", { name: "eq" }));
|
|
178
|
+
await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
|
|
179
|
+
});
|
|
208
180
|
|
|
209
181
|
await waitFor(() =>
|
|
210
|
-
expect(getByRole("button", { name: /
|
|
182
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeEnabled()
|
|
211
183
|
);
|
|
212
|
-
|
|
184
|
+
await user.click(rendered.getByText(/save/i));
|
|
213
185
|
|
|
214
186
|
await waitFor(() =>
|
|
215
187
|
expect(trigger).toHaveBeenCalledWith({
|
|
@@ -293,7 +265,8 @@ describe("<NewQualityControl />", () => {
|
|
|
293
265
|
);
|
|
294
266
|
});
|
|
295
267
|
|
|
296
|
-
it("test publish submit ", async () => {
|
|
268
|
+
it.skip("test publish submit ", async () => {
|
|
269
|
+
const user = userEvent.setup({ delay: null });
|
|
297
270
|
const trigger = jest.fn(() =>
|
|
298
271
|
Promise.resolve({ data: { data: { id: "9", version: "1" } } })
|
|
299
272
|
);
|
|
@@ -302,56 +275,51 @@ describe("<NewQualityControl />", () => {
|
|
|
302
275
|
trigger,
|
|
303
276
|
}));
|
|
304
277
|
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
getByText,
|
|
308
|
-
getByPlaceholderText,
|
|
309
|
-
queryByText,
|
|
310
|
-
getByRole,
|
|
311
|
-
} = render(<NewQualityControl />, renderOpts);
|
|
278
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
279
|
+
await waitForLoad(rendered);
|
|
312
280
|
|
|
313
281
|
await waitFor(() =>
|
|
314
|
-
expect(
|
|
315
|
-
);
|
|
316
|
-
await waitFor(() =>
|
|
317
|
-
expect(getByRole("button", { name: /Publish/ })).toBeDisabled()
|
|
282
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeDisabled()
|
|
318
283
|
);
|
|
319
284
|
|
|
320
285
|
// Fill in the 'Name' field
|
|
321
|
-
|
|
286
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "test_modified");
|
|
322
287
|
|
|
323
288
|
// Select a domain
|
|
324
|
-
|
|
325
|
-
|
|
289
|
+
await user.click(rendered.getByText(/domain.multiple.placeholder/i));
|
|
290
|
+
await user.click(rendered.getByText(/bardomain/i));
|
|
326
291
|
|
|
327
292
|
// Select a source
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
293
|
+
await user.click(rendered.getByText(/source.search.placeholder/i));
|
|
294
|
+
await user.click(
|
|
295
|
+
rendered.getByRole("option", { name: /external_source_id/i })
|
|
296
|
+
);
|
|
331
297
|
|
|
332
|
-
|
|
298
|
+
await user.click(rendered.getByRole("option", { name: /error_count/i }));
|
|
333
299
|
|
|
334
300
|
// Fill in the 'Goal' field
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
await waitFor(() =>
|
|
340
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
301
|
+
await user.type(
|
|
302
|
+
rendered.getByPlaceholderText(/score_criteria.error_count.goal/i),
|
|
303
|
+
"25"
|
|
341
304
|
);
|
|
342
|
-
|
|
343
|
-
|
|
305
|
+
// Fill in the 'Threshold' field
|
|
306
|
+
await user.type(
|
|
307
|
+
rendered.getByPlaceholderText(/score_criteria.error_count.maximum/i),
|
|
308
|
+
"50"
|
|
344
309
|
);
|
|
310
|
+
await waitForLoad(rendered);
|
|
345
311
|
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
312
|
+
// Select the 'Reference datasets' for the resource type
|
|
313
|
+
await user.click(rendered.getByText(/^queryables.resource.type$/));
|
|
314
|
+
await user.click(
|
|
315
|
+
rendered.getByText(/queryables.resource.type.reference_datase/i)
|
|
316
|
+
);
|
|
317
|
+
await user.click(rendered.getByRole("option", { name: /dataset1/i }));
|
|
350
318
|
|
|
351
319
|
await waitFor(() =>
|
|
352
|
-
expect(getByRole("button", { name: /
|
|
320
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeEnabled()
|
|
353
321
|
);
|
|
354
|
-
|
|
322
|
+
await user.click(rendered.getByText(/publish/i));
|
|
355
323
|
|
|
356
324
|
await waitFor(() =>
|
|
357
325
|
expect(trigger).toHaveBeenCalledWith({
|