@truedat/qx 7.5.7 → 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 +45 -64
- package/src/components/QxRoutes.js +38 -19
- package/src/components/__tests__/QxRoutes.spec.js +73 -0
- package/src/components/__tests__/__fixtures__/helper.js +6 -7
- 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 +36 -62
- 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 +34 -47
- 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 +19 -44
- 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 +8 -7
- package/src/components/qualityControls/ControlPropertiesView.js +5 -5
- 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 -21
- 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 +6 -12
- 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 +8 -4
- package/src/components/qualityControls/ScoreCriteriaView.js +34 -54
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +16 -21
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +5 -6
- 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 +88 -107
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +55 -63
- 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 +13 -12
- 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 +3 -4
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +18 -3
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +2 -2
- package/src/components/qualityControls/__tests__/__snapshots__/ControlProperties.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ControlPropertiesView.spec.js.snap +53 -53
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +45 -34
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +44 -33
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +30 -19
- package/src/components/qualityControls/__tests__/__snapshots__/QualityBadge.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +11 -19
- 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 +28 -5
- 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/__tests__/__snapshots__/ScoreCriteria.spec.js.snap +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/ScoreCriteriaView.spec.js.snap +2 -4
- package/src/components/qualityControls/__tests__/qualityByControlMode.spec.js +16 -16
- package/src/components/qualityControls/controlProperties/{ErrorCount.js → Count.js} +7 -7
- package/src/components/qualityControls/controlProperties/Ratio.js +6 -8
- package/src/components/qualityControls/controlProperties/__tests__/{ErrorCount.spec.js → Count.spec.js} +9 -25
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +9 -27
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/{ErrorCount.spec.js.snap → Count.spec.js.snap} +5 -5
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +10 -10
- package/src/components/qualityControls/qualityByControlMode.js +39 -16
- package/src/components/qualityControls/qualityControlScoresColumns.js +1 -2
- package/src/components/qualityControls/scoreCriterias/Count.js +88 -0
- package/src/components/qualityControls/scoreCriterias/Deviation.js +2 -2
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +4 -4
- package/src/components/qualityControls/scoreCriterias/Percentage.js +2 -2
- package/src/components/qualityControls/scoreCriterias/__tests__/Count.spec.js +62 -0
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +0 -1
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +39 -31
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +23 -19
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/Count.spec.js.snap +58 -0
- 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 +2 -3
- 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,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", () => ({
|
|
@@ -65,6 +63,11 @@ const referenceDatasetsMock = {
|
|
|
65
63
|
name: "dataset1",
|
|
66
64
|
headers: ["campo1", "campo2"],
|
|
67
65
|
},
|
|
66
|
+
{
|
|
67
|
+
id: "8",
|
|
68
|
+
name: "patito",
|
|
69
|
+
headers: ["pasto1", "pasto2"],
|
|
70
|
+
},
|
|
68
71
|
],
|
|
69
72
|
loading: false,
|
|
70
73
|
},
|
|
@@ -95,45 +98,29 @@ const renderOpts = {
|
|
|
95
98
|
createDomainsMock,
|
|
96
99
|
domainsMock,
|
|
97
100
|
],
|
|
98
|
-
messages,
|
|
99
|
-
fallback: "loading",
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
describe("<NewQualityControl />", () => {
|
|
103
104
|
it("matches the latest snapshot", async () => {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
renderOpts
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
await waitFor(() =>
|
|
111
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
112
|
-
);
|
|
113
|
-
await waitFor(() =>
|
|
114
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
115
|
-
);
|
|
116
|
-
expect(container).toMatchSnapshot();
|
|
105
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
106
|
+
await waitForLoad(rendered);
|
|
107
|
+
expect(rendered.container).toMatchSnapshot();
|
|
117
108
|
});
|
|
118
109
|
|
|
119
110
|
it("navigates to qulity controls when cancel button is cliked", async () => {
|
|
120
|
-
const {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
await
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
await waitFor(() =>
|
|
128
|
-
|
|
129
|
-
);
|
|
130
|
-
userEvent.click(getByText(/Cancel/));
|
|
131
|
-
userEvent.click(getByText(/confirm_yes/));
|
|
132
|
-
await waitFor(() => expect(mockHistory.push.mock.calls.length).toBe(1));
|
|
133
|
-
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");
|
|
134
120
|
});
|
|
135
121
|
|
|
136
122
|
it("test save submit ", async () => {
|
|
123
|
+
const user = userEvent.setup({ delay: null });
|
|
137
124
|
const trigger = jest.fn(() =>
|
|
138
125
|
Promise.resolve({ data: { data: { id: "9", version: "1" } } })
|
|
139
126
|
);
|
|
@@ -142,62 +129,59 @@ describe("<NewQualityControl />", () => {
|
|
|
142
129
|
trigger,
|
|
143
130
|
}));
|
|
144
131
|
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
getByText,
|
|
148
|
-
getByPlaceholderText,
|
|
149
|
-
queryByText,
|
|
150
|
-
getByRole,
|
|
151
|
-
getAllByRole,
|
|
152
|
-
} = render(<NewQualityControl />, renderOpts);
|
|
132
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
133
|
+
await waitForLoad(rendered);
|
|
153
134
|
|
|
154
135
|
await waitFor(() =>
|
|
155
|
-
expect(
|
|
156
|
-
);
|
|
157
|
-
await waitFor(() =>
|
|
158
|
-
expect(getByRole("button", { name: /Save/ })).toBeDisabled()
|
|
136
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
159
137
|
);
|
|
160
138
|
|
|
161
|
-
// Fill in the 'Name' field
|
|
162
|
-
userEvent.type(getByPlaceholderText("Name"), "test_modified");
|
|
163
|
-
|
|
164
139
|
// Select a domain
|
|
165
|
-
|
|
166
|
-
|
|
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");
|
|
167
145
|
|
|
168
146
|
// Select a source
|
|
169
|
-
|
|
170
|
-
|
|
147
|
+
await user.click(rendered.getByText(/source.search.placeholder/i));
|
|
148
|
+
await user.click(
|
|
149
|
+
rendered.getByRole("option", { name: /external_source_id/i })
|
|
150
|
+
);
|
|
171
151
|
|
|
172
152
|
// Select a control mode
|
|
173
|
-
|
|
153
|
+
await user.click(
|
|
154
|
+
rendered.getByRole("option", { name: /control_mode.percentage/i })
|
|
155
|
+
);
|
|
174
156
|
|
|
175
157
|
// Fill in the 'Threshold' field
|
|
176
|
-
|
|
158
|
+
await user.type(
|
|
159
|
+
rendered.getByPlaceholderText(/score_criteria.percentage.minimum/i),
|
|
160
|
+
"10"
|
|
161
|
+
);
|
|
177
162
|
|
|
178
163
|
// Fill in the 'Goal' field
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
183
|
-
);
|
|
184
|
-
await waitFor(() =>
|
|
185
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
164
|
+
await user.type(
|
|
165
|
+
rendered.getByPlaceholderText(/score_criteria.percentage.goal/i),
|
|
166
|
+
"20"
|
|
186
167
|
);
|
|
187
168
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
169
|
+
await waitForLoad(rendered);
|
|
170
|
+
|
|
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 }));
|
|
192
174
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
+
});
|
|
196
180
|
|
|
197
181
|
await waitFor(() =>
|
|
198
|
-
expect(getByRole("button", { name: /
|
|
182
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeEnabled()
|
|
199
183
|
);
|
|
200
|
-
|
|
184
|
+
await user.click(rendered.getByText(/save/i));
|
|
201
185
|
|
|
202
186
|
await waitFor(() =>
|
|
203
187
|
expect(trigger).toHaveBeenCalledWith({
|
|
@@ -281,7 +265,8 @@ describe("<NewQualityControl />", () => {
|
|
|
281
265
|
);
|
|
282
266
|
});
|
|
283
267
|
|
|
284
|
-
it("test publish submit ", async () => {
|
|
268
|
+
it.skip("test publish submit ", async () => {
|
|
269
|
+
const user = userEvent.setup({ delay: null });
|
|
285
270
|
const trigger = jest.fn(() =>
|
|
286
271
|
Promise.resolve({ data: { data: { id: "9", version: "1" } } })
|
|
287
272
|
);
|
|
@@ -290,55 +275,51 @@ describe("<NewQualityControl />", () => {
|
|
|
290
275
|
trigger,
|
|
291
276
|
}));
|
|
292
277
|
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
getByText,
|
|
296
|
-
getByPlaceholderText,
|
|
297
|
-
queryByText,
|
|
298
|
-
getByRole,
|
|
299
|
-
} = render(<NewQualityControl />, renderOpts);
|
|
278
|
+
const rendered = render(<NewQualityControl />, renderOpts);
|
|
279
|
+
await waitForLoad(rendered);
|
|
300
280
|
|
|
301
281
|
await waitFor(() =>
|
|
302
|
-
expect(
|
|
303
|
-
);
|
|
304
|
-
await waitFor(() =>
|
|
305
|
-
expect(getByRole("button", { name: /Publish/ })).toBeDisabled()
|
|
282
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeDisabled()
|
|
306
283
|
);
|
|
307
284
|
|
|
308
285
|
// Fill in the 'Name' field
|
|
309
|
-
|
|
286
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "test_modified");
|
|
310
287
|
|
|
311
288
|
// Select a domain
|
|
312
|
-
|
|
313
|
-
|
|
289
|
+
await user.click(rendered.getByText(/domain.multiple.placeholder/i));
|
|
290
|
+
await user.click(rendered.getByText(/bardomain/i));
|
|
314
291
|
|
|
315
292
|
// Select a source
|
|
316
|
-
|
|
317
|
-
|
|
293
|
+
await user.click(rendered.getByText(/source.search.placeholder/i));
|
|
294
|
+
await user.click(
|
|
295
|
+
rendered.getByRole("option", { name: /external_source_id/i })
|
|
296
|
+
);
|
|
318
297
|
|
|
319
|
-
|
|
298
|
+
await user.click(rendered.getByRole("option", { name: /error_count/i }));
|
|
320
299
|
|
|
321
300
|
// Fill in the 'Goal' field
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
await waitFor(() =>
|
|
327
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
301
|
+
await user.type(
|
|
302
|
+
rendered.getByPlaceholderText(/score_criteria.error_count.goal/i),
|
|
303
|
+
"25"
|
|
328
304
|
);
|
|
329
|
-
|
|
330
|
-
|
|
305
|
+
// Fill in the 'Threshold' field
|
|
306
|
+
await user.type(
|
|
307
|
+
rendered.getByPlaceholderText(/score_criteria.error_count.maximum/i),
|
|
308
|
+
"50"
|
|
331
309
|
);
|
|
310
|
+
await waitForLoad(rendered);
|
|
332
311
|
|
|
333
|
-
//
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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 }));
|
|
337
318
|
|
|
338
319
|
await waitFor(() =>
|
|
339
|
-
expect(getByRole("button", { name: /
|
|
320
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeEnabled()
|
|
340
321
|
);
|
|
341
|
-
|
|
322
|
+
await user.click(rendered.getByText(/publish/i));
|
|
342
323
|
|
|
343
324
|
await waitFor(() =>
|
|
344
325
|
expect(trigger).toHaveBeenCalledWith({
|
|
@@ -348,7 +329,7 @@ describe("<NewQualityControl />", () => {
|
|
|
348
329
|
domain_ids: ["2"],
|
|
349
330
|
df_type: "template1",
|
|
350
331
|
source_id: 181,
|
|
351
|
-
control_mode: "
|
|
332
|
+
control_mode: "count",
|
|
352
333
|
dynamic_content: {},
|
|
353
334
|
control_properties: {
|
|
354
335
|
errors_resource: {
|
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
4
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
2
|
import { scoreData } from "@truedat/qx/components/scores/__tests__/__fixtures__/scoreHelper";
|
|
6
3
|
import QualityBadge, { QualityBadgeForSearch } from "../QualityBadge";
|
|
7
4
|
|
|
8
|
-
const renderOpts = { messages };
|
|
9
|
-
|
|
10
5
|
describe("<QualityBadge />", () => {
|
|
11
|
-
it("matches the latest snapshot", () => {
|
|
6
|
+
it("matches the latest snapshot", async () => {
|
|
12
7
|
const score = scoreData();
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
expect(container).toMatchSnapshot();
|
|
8
|
+
const rendered = render(<QualityBadge score={score} />);
|
|
9
|
+
await waitForLoad(rendered);
|
|
10
|
+
expect(rendered.container).toMatchSnapshot();
|
|
16
11
|
});
|
|
17
12
|
|
|
18
|
-
it("show status failed", () => {
|
|
13
|
+
it("show status failed", async () => {
|
|
19
14
|
const score = scoreData({ status: "FAILED" });
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
expect(queryByText(/
|
|
15
|
+
const rendered = render(<QualityBadge score={score} />);
|
|
16
|
+
await waitForLoad(rendered);
|
|
17
|
+
expect(rendered.queryByText(/failed/i)).toBeInTheDocument();
|
|
23
18
|
});
|
|
24
19
|
|
|
25
|
-
it("show no executed", () => {
|
|
20
|
+
it("show no executed", async () => {
|
|
26
21
|
const score = scoreData({ score_content: undefined });
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const rendered = render(<QualityBadge score={score} />);
|
|
23
|
+
await waitForLoad(rendered);
|
|
24
|
+
rendered.debug();
|
|
25
|
+
expect(rendered.queryByText(/score.not_executed/i)).toBeInTheDocument();
|
|
30
26
|
});
|
|
31
27
|
|
|
32
|
-
it("show no results", () => {
|
|
28
|
+
it("show no results", async () => {
|
|
33
29
|
const score_content = {
|
|
34
30
|
total_count: 0,
|
|
35
31
|
validation_count: 50,
|
|
36
32
|
};
|
|
37
33
|
|
|
38
34
|
const score = scoreData({ score_content });
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
const rendered = render(<QualityBadge score={score} />);
|
|
36
|
+
await waitForLoad(rendered);
|
|
37
|
+
rendered.debug();
|
|
38
|
+
expect(rendered.queryByText(/score.no_results/i)).toBeInTheDocument();
|
|
42
39
|
});
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
describe("<QualityBadgeForSearch />", () => {
|
|
46
|
-
it("matches the latest snapshot for percentage", () => {
|
|
43
|
+
it("matches the latest snapshot for percentage", async () => {
|
|
47
44
|
const scoreCriteria = {
|
|
48
45
|
goal: 60,
|
|
49
46
|
maximum: 75,
|
|
@@ -60,19 +57,18 @@ describe("<QualityBadgeForSearch />", () => {
|
|
|
60
57
|
type: "ratio",
|
|
61
58
|
};
|
|
62
59
|
|
|
63
|
-
const
|
|
60
|
+
const rendered = render(
|
|
64
61
|
<QualityBadgeForSearch
|
|
65
62
|
controlMode={"percentage"}
|
|
66
63
|
criteria={scoreCriteria}
|
|
67
64
|
latestScore={latestScore}
|
|
68
|
-
|
|
69
|
-
renderOpts
|
|
65
|
+
/>
|
|
70
66
|
);
|
|
71
|
-
|
|
72
|
-
expect(container).toMatchSnapshot();
|
|
67
|
+
await waitForLoad(rendered);
|
|
68
|
+
expect(rendered.container).toMatchSnapshot();
|
|
73
69
|
});
|
|
74
70
|
|
|
75
|
-
it("matches the latest snapshot for deviation", () => {
|
|
71
|
+
it("matches the latest snapshot for deviation", async () => {
|
|
76
72
|
const scoreCriteria = {
|
|
77
73
|
goal: 78,
|
|
78
74
|
maximum: 90,
|
|
@@ -89,47 +85,45 @@ describe("<QualityBadgeForSearch />", () => {
|
|
|
89
85
|
type: "ratio",
|
|
90
86
|
};
|
|
91
87
|
|
|
92
|
-
const
|
|
88
|
+
const rendered = render(
|
|
93
89
|
<QualityBadgeForSearch
|
|
94
90
|
controlMode={"deviation"}
|
|
95
91
|
criteria={scoreCriteria}
|
|
96
92
|
latestScore={latestScore}
|
|
97
|
-
|
|
98
|
-
renderOpts
|
|
93
|
+
/>
|
|
99
94
|
);
|
|
100
|
-
|
|
101
|
-
expect(container).toMatchSnapshot();
|
|
95
|
+
await waitForLoad(rendered);
|
|
96
|
+
expect(rendered.container).toMatchSnapshot();
|
|
102
97
|
});
|
|
103
98
|
|
|
104
|
-
it("matches the latest snapshot for
|
|
99
|
+
it("matches the latest snapshot for count", async () => {
|
|
105
100
|
const scoreCriteria = {
|
|
106
101
|
goal: 78,
|
|
107
102
|
maximum: 90,
|
|
108
103
|
};
|
|
109
104
|
const latestScore = {
|
|
110
105
|
executed_at: "2025-03-25T05:34:21.438113Z",
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
count_content: {
|
|
107
|
+
count: 200,
|
|
113
108
|
},
|
|
114
109
|
result: 200,
|
|
115
110
|
result_message: "under_threshold",
|
|
116
111
|
status: "succeeded",
|
|
117
|
-
type: "
|
|
112
|
+
type: "count",
|
|
118
113
|
};
|
|
119
114
|
|
|
120
|
-
const
|
|
115
|
+
const rendered = render(
|
|
121
116
|
<QualityBadgeForSearch
|
|
122
|
-
controlMode={"
|
|
117
|
+
controlMode={"count"}
|
|
123
118
|
criteria={scoreCriteria}
|
|
124
119
|
latestScore={latestScore}
|
|
125
|
-
|
|
126
|
-
renderOpts
|
|
120
|
+
/>
|
|
127
121
|
);
|
|
128
|
-
|
|
129
|
-
expect(container).toMatchSnapshot();
|
|
122
|
+
await waitForLoad(rendered);
|
|
123
|
+
expect(rendered.container).toMatchSnapshot();
|
|
130
124
|
});
|
|
131
125
|
|
|
132
|
-
it("show status failed", () => {
|
|
126
|
+
it("show status failed", async () => {
|
|
133
127
|
const latestScore = {
|
|
134
128
|
result_message: null,
|
|
135
129
|
status: "failed",
|
|
@@ -139,19 +133,18 @@ describe("<QualityBadgeForSearch />", () => {
|
|
|
139
133
|
minimum: 10,
|
|
140
134
|
};
|
|
141
135
|
|
|
142
|
-
const
|
|
136
|
+
const rendered = render(
|
|
143
137
|
<QualityBadgeForSearch
|
|
144
138
|
controlMode={"percentage"}
|
|
145
139
|
criteria={scoreCriteria}
|
|
146
140
|
latestScore={latestScore}
|
|
147
|
-
|
|
148
|
-
renderOpts
|
|
141
|
+
/>
|
|
149
142
|
);
|
|
150
|
-
|
|
151
|
-
expect(queryByText(/
|
|
143
|
+
await waitForLoad(rendered);
|
|
144
|
+
expect(rendered.queryByText(/failed/i)).toBeInTheDocument();
|
|
152
145
|
});
|
|
153
146
|
|
|
154
|
-
it("show no executed", () => {
|
|
147
|
+
it("show no executed", async () => {
|
|
155
148
|
const scoreCriteria = {
|
|
156
149
|
goal: 78,
|
|
157
150
|
maximum: 90,
|
|
@@ -159,19 +152,18 @@ describe("<QualityBadgeForSearch />", () => {
|
|
|
159
152
|
const latestScore = {
|
|
160
153
|
result_message: null,
|
|
161
154
|
};
|
|
162
|
-
const
|
|
155
|
+
const rendered = render(
|
|
163
156
|
<QualityBadgeForSearch
|
|
164
|
-
controlMode={"
|
|
157
|
+
controlMode={"count"}
|
|
165
158
|
criteria={scoreCriteria}
|
|
166
159
|
latestScore={latestScore}
|
|
167
|
-
|
|
168
|
-
renderOpts
|
|
160
|
+
/>
|
|
169
161
|
);
|
|
170
|
-
|
|
171
|
-
expect(container).toMatchSnapshot();
|
|
162
|
+
await waitForLoad(rendered);
|
|
163
|
+
expect(rendered.container).toMatchSnapshot();
|
|
172
164
|
});
|
|
173
165
|
|
|
174
|
-
it("show no results", () => {
|
|
166
|
+
it("show no results", async () => {
|
|
175
167
|
const scoreCriteria = {
|
|
176
168
|
goal: 60,
|
|
177
169
|
maximum: 75,
|
|
@@ -187,15 +179,15 @@ describe("<QualityBadgeForSearch />", () => {
|
|
|
187
179
|
status: "succeeded",
|
|
188
180
|
type: "ratio",
|
|
189
181
|
};
|
|
190
|
-
const
|
|
182
|
+
const rendered = render(
|
|
191
183
|
<QualityBadgeForSearch
|
|
192
184
|
controlMode={"percentage"}
|
|
193
185
|
criteria={scoreCriteria}
|
|
194
186
|
latestScore={latestScore}
|
|
195
|
-
|
|
196
|
-
renderOpts
|
|
187
|
+
/>
|
|
197
188
|
);
|
|
198
|
-
|
|
199
|
-
|
|
189
|
+
await waitForLoad(rendered);
|
|
190
|
+
rendered.debug();
|
|
191
|
+
expect(rendered.queryByText(/score.no_results/i)).toBeInTheDocument();
|
|
200
192
|
});
|
|
201
193
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { waitFor } from "@testing-library/react";
|
|
4
3
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
5
4
|
import userEvent from "@testing-library/user-event";
|
|
6
5
|
import { templateByNameMock } from "@truedat/test/mocks";
|
|
7
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
8
6
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
9
7
|
import QualityControl from "../QualityControl";
|
|
10
8
|
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
@@ -41,8 +39,6 @@ const renderOpts = {
|
|
|
41
39
|
createDomainsMock,
|
|
42
40
|
templateByNameMock({ name: "template1", domainIds: [2] }),
|
|
43
41
|
],
|
|
44
|
-
messages,
|
|
45
|
-
fallback: "loading",
|
|
46
42
|
};
|
|
47
43
|
|
|
48
44
|
describe("<QualityControl />", () => {
|
|
@@ -51,35 +47,28 @@ describe("<QualityControl />", () => {
|
|
|
51
47
|
qualityControl: qualityControlData(),
|
|
52
48
|
actions: ["update_main"],
|
|
53
49
|
};
|
|
54
|
-
const
|
|
50
|
+
const rendered = render(
|
|
55
51
|
<TestFormWrapper context={context}>
|
|
56
52
|
<QualityControl />
|
|
57
53
|
</TestFormWrapper>,
|
|
58
54
|
renderOpts
|
|
59
55
|
);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument();
|
|
63
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
expect(container).toMatchSnapshot();
|
|
56
|
+
await waitForLoad(rendered);
|
|
57
|
+
expect(rendered.container).toMatchSnapshot();
|
|
67
58
|
});
|
|
68
59
|
|
|
69
60
|
it("do not show edit domain if the user does not have permissions", async () => {
|
|
70
61
|
const context = { qualityControl: qualityControlData() };
|
|
71
|
-
const
|
|
62
|
+
const rendered = render(
|
|
72
63
|
<TestFormWrapper context={context}>
|
|
73
64
|
<QualityControl />
|
|
74
65
|
</TestFormWrapper>,
|
|
75
66
|
renderOpts
|
|
76
67
|
);
|
|
77
|
-
await
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
).not.toBeInTheDocument();
|
|
82
|
-
});
|
|
68
|
+
await waitForLoad(rendered);
|
|
69
|
+
expect(
|
|
70
|
+
rendered.container.querySelector(".pencil.alternate.icon")
|
|
71
|
+
).not.toBeInTheDocument();
|
|
83
72
|
});
|
|
84
73
|
|
|
85
74
|
it("render popup when edit domain", async () => {
|
|
@@ -87,27 +76,25 @@ describe("<QualityControl />", () => {
|
|
|
87
76
|
qualityControl: qualityControlData(),
|
|
88
77
|
actions: ["update_main"],
|
|
89
78
|
};
|
|
90
|
-
const
|
|
79
|
+
const rendered = render(
|
|
91
80
|
<TestFormWrapper context={context}>
|
|
92
81
|
<QualityControl />
|
|
93
82
|
</TestFormWrapper>,
|
|
94
83
|
renderOpts
|
|
95
84
|
);
|
|
85
|
+
await waitForLoad(rendered);
|
|
96
86
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const pencilButton = container.querySelector(".pencil.alternate.icon");
|
|
87
|
+
const pencilButton = rendered.container.querySelector(
|
|
88
|
+
".pencil.alternate.icon"
|
|
89
|
+
);
|
|
103
90
|
userEvent.click(pencilButton);
|
|
104
91
|
|
|
105
92
|
await waitFor(() => {
|
|
106
|
-
expect(queryByText(/
|
|
93
|
+
expect(rendered.queryByText(/foodomain/i)).toBeInTheDocument();
|
|
107
94
|
});
|
|
108
95
|
userEvent.click(pencilButton);
|
|
109
96
|
await waitFor(() => {
|
|
110
|
-
expect(queryByText(/
|
|
97
|
+
expect(rendered.queryByText(/foodomain/i)).not.toBeInTheDocument();
|
|
111
98
|
});
|
|
112
99
|
});
|
|
113
100
|
|
|
@@ -115,14 +102,15 @@ describe("<QualityControl />", () => {
|
|
|
115
102
|
const context = {
|
|
116
103
|
qualityControl: qualityControlData({ df_type: undefined }),
|
|
117
104
|
};
|
|
118
|
-
const
|
|
105
|
+
const rendered = render(
|
|
119
106
|
<TestFormWrapper context={context}>
|
|
120
107
|
<QualityControl />
|
|
121
108
|
</TestFormWrapper>,
|
|
122
109
|
renderOpts
|
|
123
110
|
);
|
|
111
|
+
await waitForLoad(rendered);
|
|
124
112
|
await waitFor(() =>
|
|
125
|
-
expect(queryByText(/
|
|
113
|
+
expect(rendered.queryByText(/information/i)).not.toBeInTheDocument()
|
|
126
114
|
);
|
|
127
115
|
});
|
|
128
116
|
});
|