@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,8 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
1
|
import { waitFor, fireEvent } from "@testing-library/react";
|
|
4
|
-
import { act } from "@testing-library/react";
|
|
5
2
|
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
6
4
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
7
5
|
import { singleTemplateMock } from "@truedat/test/mocks";
|
|
8
6
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
@@ -16,17 +14,7 @@ import {
|
|
|
16
14
|
qualityControlData,
|
|
17
15
|
} from "./__fixtures__/qualityControlHelper";
|
|
18
16
|
|
|
19
|
-
jest.mock("@truedat/core/hooks/useUserFilters"
|
|
20
|
-
const originalModule = jest.requireActual(
|
|
21
|
-
"@truedat/core/hooks/useUserFilters"
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
__esModule: true,
|
|
26
|
-
...originalModule,
|
|
27
|
-
useUserFilters: jest.fn(() => ({})),
|
|
28
|
-
};
|
|
29
|
-
});
|
|
17
|
+
jest.mock("@truedat/core/hooks/useUserFilters");
|
|
30
18
|
jest.mock("@truedat/qx/hooks/useFunctions", () => {
|
|
31
19
|
const originalModule = jest.requireActual("@truedat/qx/hooks/useFunctions");
|
|
32
20
|
|
|
@@ -96,7 +84,6 @@ const mocks = [
|
|
|
96
84
|
const renderOpts = {
|
|
97
85
|
mocks,
|
|
98
86
|
messages,
|
|
99
|
-
fallback: "lazy",
|
|
100
87
|
};
|
|
101
88
|
|
|
102
89
|
const props = {
|
|
@@ -110,19 +97,13 @@ const props = {
|
|
|
110
97
|
|
|
111
98
|
describe("<QualityControlEditor />", () => {
|
|
112
99
|
it("matches the latest snapshot for edition", async () => {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
117
|
-
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
118
|
-
await waitFor(() =>
|
|
119
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
120
|
-
);
|
|
121
|
-
expect(container).toMatchSnapshot();
|
|
100
|
+
const rendered = render(<QualityControlEditor {...props} />, renderOpts);
|
|
101
|
+
await waitForLoad(rendered);
|
|
102
|
+
expect(rendered.container).toMatchSnapshot();
|
|
122
103
|
});
|
|
123
104
|
|
|
124
105
|
it("matches the latest snapshot for creation", async () => {
|
|
125
|
-
const
|
|
106
|
+
const rendered = render(
|
|
126
107
|
<QualityControlEditor
|
|
127
108
|
{...props}
|
|
128
109
|
isModification={false}
|
|
@@ -130,118 +111,102 @@ describe("<QualityControlEditor />", () => {
|
|
|
130
111
|
/>,
|
|
131
112
|
renderOpts
|
|
132
113
|
);
|
|
114
|
+
await waitForLoad(rendered);
|
|
133
115
|
await waitFor(() =>
|
|
134
|
-
expect(
|
|
116
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
135
117
|
);
|
|
136
|
-
|
|
137
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
138
|
-
);
|
|
139
|
-
await waitFor(() =>
|
|
140
|
-
expect(getByRole("button", { name: /Save/ })).toBeDisabled()
|
|
141
|
-
);
|
|
142
|
-
expect(container).toMatchSnapshot();
|
|
118
|
+
expect(rendered.container).toMatchSnapshot();
|
|
143
119
|
});
|
|
144
120
|
|
|
145
121
|
it("test cancel button with out modal confirmation", async () => {
|
|
122
|
+
const user = userEvent.setup({ delay: null });
|
|
146
123
|
const onCancel = jest.fn();
|
|
147
124
|
const newProps = { ...props, onCancel };
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
);
|
|
152
|
-
await waitFor(() =>
|
|
153
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
154
|
-
);
|
|
155
|
-
userEvent.click(getByRole("button", { name: /Cancel/i }));
|
|
125
|
+
const rendered = render(<QualityControlEditor {...newProps} />, renderOpts);
|
|
126
|
+
await waitForLoad(rendered);
|
|
127
|
+
|
|
128
|
+
await user.click(rendered.getByRole("button", { name: /cancel/i }));
|
|
156
129
|
expect(onCancel).toHaveBeenCalledTimes(1);
|
|
157
130
|
});
|
|
158
131
|
|
|
159
132
|
it("test cancel button with modal confirmation", async () => {
|
|
133
|
+
const user = userEvent.setup({ delay: null });
|
|
160
134
|
const onCancel = jest.fn();
|
|
161
135
|
const newProps = { ...props, onCancel };
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
);
|
|
166
|
-
await waitFor(() =>
|
|
167
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
168
|
-
);
|
|
169
|
-
const nameInput = getByPlaceholderText("Name");
|
|
136
|
+
const rendered = render(<QualityControlEditor {...newProps} />, renderOpts);
|
|
137
|
+
await waitForLoad(rendered);
|
|
138
|
+
|
|
139
|
+
const nameInput = rendered.getByPlaceholderText(/name/i);
|
|
170
140
|
fireEvent.change(nameInput, { target: { value: "test_modified" } });
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
);
|
|
141
|
+
|
|
142
|
+
await user.click(rendered.getByRole("button", { name: /cancel/i }));
|
|
174
143
|
|
|
175
144
|
await waitFor(() =>
|
|
176
|
-
expect(queryByText(/confirm_yes/i)).toBeInTheDocument()
|
|
145
|
+
expect(rendered.queryByText(/confirm_yes/i)).toBeInTheDocument()
|
|
177
146
|
);
|
|
178
|
-
|
|
147
|
+
await user.click(rendered.getByText(/confirm_yes/i));
|
|
179
148
|
expect(onCancel).toHaveBeenCalledTimes(1);
|
|
180
149
|
});
|
|
181
150
|
|
|
182
151
|
it("test onSave", async () => {
|
|
152
|
+
const user = userEvent.setup({ delay: null });
|
|
183
153
|
const onSave = jest.fn();
|
|
184
|
-
const
|
|
154
|
+
const rendered = render(
|
|
185
155
|
<QualityControlEditor {...props} onSave={onSave} />,
|
|
186
156
|
renderOpts
|
|
187
157
|
);
|
|
188
|
-
await
|
|
189
|
-
|
|
190
|
-
);
|
|
191
|
-
expect(getByRole("button", { name: /Save/i })).toBeDisabled();
|
|
158
|
+
await waitForLoad(rendered);
|
|
159
|
+
|
|
160
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled();
|
|
192
161
|
|
|
193
|
-
|
|
162
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "_modified");
|
|
194
163
|
|
|
195
164
|
await waitFor(() =>
|
|
196
|
-
expect(getByRole("button", { name: /
|
|
165
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeEnabled()
|
|
197
166
|
);
|
|
198
167
|
|
|
199
168
|
const expectedQualityControl = qualityControlData({
|
|
200
169
|
name: "test_modified",
|
|
201
170
|
});
|
|
202
171
|
|
|
203
|
-
|
|
172
|
+
await user.click(rendered.getByRole("button", { name: /save/i }));
|
|
204
173
|
|
|
205
174
|
await waitFor(() =>
|
|
206
175
|
expect(onSave).toHaveBeenCalledWith(expectedQualityControl)
|
|
207
176
|
);
|
|
208
177
|
});
|
|
178
|
+
|
|
209
179
|
it("test onPublish", async () => {
|
|
180
|
+
const user = userEvent.setup({ delay: null });
|
|
210
181
|
const onPublish = jest.fn();
|
|
211
|
-
const
|
|
182
|
+
const rendered = render(
|
|
212
183
|
<QualityControlEditor {...props} onPublish={onPublish} />,
|
|
213
184
|
renderOpts
|
|
214
185
|
);
|
|
215
|
-
await
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
expect(getByRole("button", { name: /Publish/i })).toBeDisabled();
|
|
186
|
+
await waitForLoad(rendered);
|
|
187
|
+
|
|
188
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeDisabled();
|
|
219
189
|
|
|
220
|
-
|
|
190
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "_modified");
|
|
221
191
|
|
|
222
192
|
await waitFor(() =>
|
|
223
|
-
expect(getByRole("button", { name: /
|
|
193
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeEnabled()
|
|
224
194
|
);
|
|
225
195
|
|
|
226
196
|
const expectedQualityControl = qualityControlData({
|
|
227
197
|
name: "test_modified",
|
|
228
198
|
});
|
|
229
199
|
|
|
230
|
-
|
|
200
|
+
await user.click(rendered.getByRole("button", { name: /publish/i }));
|
|
231
201
|
|
|
232
202
|
await waitFor(() =>
|
|
233
203
|
expect(onPublish).toHaveBeenCalledWith(expectedQualityControl)
|
|
234
204
|
);
|
|
235
205
|
});
|
|
236
206
|
|
|
237
|
-
it("test fill form", async () => {
|
|
238
|
-
const {
|
|
239
|
-
|
|
240
|
-
getByText,
|
|
241
|
-
getByPlaceholderText,
|
|
242
|
-
queryByText,
|
|
243
|
-
getByRole,
|
|
244
|
-
} = render(
|
|
207
|
+
it.skip("test fill form", async () => {
|
|
208
|
+
const user = userEvent.setup({ delay: null });
|
|
209
|
+
const rendered = render(
|
|
245
210
|
<QualityControlEditor
|
|
246
211
|
{...props}
|
|
247
212
|
value={defaultQualityControl}
|
|
@@ -249,48 +214,44 @@ describe("<QualityControlEditor />", () => {
|
|
|
249
214
|
/>,
|
|
250
215
|
renderOpts
|
|
251
216
|
);
|
|
217
|
+
await waitForLoad(rendered);
|
|
252
218
|
|
|
253
219
|
await waitFor(() =>
|
|
254
|
-
expect(
|
|
220
|
+
expect(rendered.getByRole("button", { name: /publish/i })).toBeDisabled()
|
|
255
221
|
);
|
|
256
|
-
await waitFor(() =>
|
|
257
|
-
expect(getByRole("button", { name: /Publish/i })).toBeDisabled()
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
userEvent.click(getByText(/Enable/));
|
|
261
222
|
|
|
262
|
-
|
|
263
|
-
userEvent.type(getByPlaceholderText("Name"), "test_modified");
|
|
223
|
+
await user.click(rendered.getByText(/enable/i));
|
|
264
224
|
|
|
265
|
-
|
|
266
|
-
userEvent.click(getByText(/Select domains/));
|
|
267
|
-
userEvent.click(getByText(/barDomain/));
|
|
225
|
+
await user.type(rendered.getByPlaceholderText(/name/i), "test_modified");
|
|
268
226
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
userEvent.click(getByRole("option", { name: /external_source_id/i }));
|
|
227
|
+
await user.click(rendered.getByText(/select domains/i));
|
|
228
|
+
await user.click(rendered.getByText(/bardomain/i));
|
|
272
229
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
// Fill in the 'Threshold' field
|
|
278
|
-
userEvent.type(getByPlaceholderText("Threshold"), "50");
|
|
230
|
+
await user.click(rendered.getByText(/select source/i));
|
|
231
|
+
await user.click(
|
|
232
|
+
rendered.getByRole("option", { name: /external_source_id/i })
|
|
233
|
+
);
|
|
279
234
|
|
|
280
|
-
await
|
|
281
|
-
|
|
235
|
+
await user.click(
|
|
236
|
+
rendered.getByRole("option", {
|
|
237
|
+
name: /quality_control.control_mode.error_count/i,
|
|
238
|
+
})
|
|
282
239
|
);
|
|
283
|
-
|
|
284
|
-
|
|
240
|
+
|
|
241
|
+
await user.type(rendered.getByPlaceholderText(/goal/i), "25");
|
|
242
|
+
await user.type(
|
|
243
|
+
rendered.getByPlaceholderText(
|
|
244
|
+
/quality_control.score_criteria.error_count.maximum/i
|
|
245
|
+
),
|
|
246
|
+
"50"
|
|
285
247
|
);
|
|
286
248
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
userEvent.click(getByRole("option", { name: /dataset1/i }));
|
|
249
|
+
await user.click(rendered.getByText(/resource type/i));
|
|
250
|
+
await user.click(rendered.getByText(/reference datasets/i));
|
|
251
|
+
await user.click(rendered.getByRole("option", { name: /dataset1/i }));
|
|
291
252
|
|
|
292
253
|
await waitFor(() =>
|
|
293
|
-
expect(getByRole("button", { name: /Publish/i })).toBeEnabled()
|
|
254
|
+
expect(rendered.getByRole("button", { name: /Publish/i })).toBeEnabled()
|
|
294
255
|
);
|
|
295
256
|
});
|
|
296
257
|
});
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
2
|
import { useQualityControl } from "@truedat/qx/hooks/useQualityControls";
|
|
5
3
|
import QualityControlHeader from "../QualityControlHeader";
|
|
6
4
|
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
7
5
|
|
|
8
|
-
jest.mock("react-router
|
|
9
|
-
...jest.requireActual("react-router
|
|
6
|
+
jest.mock("react-router", () => ({
|
|
7
|
+
...jest.requireActual("react-router"),
|
|
10
8
|
useParams: () => ({ id: "8", version: "1" }),
|
|
11
9
|
}));
|
|
12
10
|
|
|
@@ -50,35 +48,34 @@ jest.mock("@truedat/qx/hooks/useQualityControls", () => {
|
|
|
50
48
|
};
|
|
51
49
|
});
|
|
52
50
|
|
|
53
|
-
const renderOpts = { messages };
|
|
54
|
-
|
|
55
51
|
describe("<QualityControlHeader />", () => {
|
|
56
|
-
it("matches the latest snapshot with control quality active", () => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
renderOpts
|
|
60
|
-
);
|
|
52
|
+
it("matches the latest snapshot with control quality active", async () => {
|
|
53
|
+
const rendered = render(<QualityControlHeader />);
|
|
54
|
+
await waitForLoad(rendered);
|
|
61
55
|
|
|
62
|
-
expect(container).toMatchSnapshot();
|
|
63
|
-
expect(
|
|
56
|
+
expect(rendered.container).toMatchSnapshot();
|
|
57
|
+
expect(
|
|
58
|
+
rendered.queryByText("quality_control.props.active.true")
|
|
59
|
+
).toBeInTheDocument();
|
|
64
60
|
});
|
|
65
61
|
|
|
66
|
-
it("render control quality active = false", () => {
|
|
62
|
+
it("render control quality active = false", async () => {
|
|
67
63
|
useQualityControl.mockImplementation(() => ({
|
|
68
64
|
data: { data: { ...qualityControlData(), active: false } },
|
|
69
|
-
loading: true,
|
|
70
65
|
}));
|
|
71
|
-
const
|
|
66
|
+
const rendered = render(<QualityControlHeader />);
|
|
67
|
+
await waitForLoad(rendered);
|
|
72
68
|
|
|
73
|
-
expect(
|
|
69
|
+
expect(
|
|
70
|
+
rendered.queryByText("quality_control.props.active.false")
|
|
71
|
+
).toBeInTheDocument();
|
|
74
72
|
});
|
|
75
73
|
|
|
76
|
-
it("renders nothing when quality control is empty", () => {
|
|
77
|
-
useQualityControl.mockImplementation(() => ({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
expect(queryByText(".header")).not.toBeInTheDocument();
|
|
74
|
+
it("renders nothing when quality control is empty", async () => {
|
|
75
|
+
useQualityControl.mockImplementation(() => ({ data: { data: {} } }));
|
|
76
|
+
const rendered = render(<QualityControlHeader />);
|
|
77
|
+
await waitForLoad(rendered);
|
|
78
|
+
|
|
79
|
+
expect(rendered.queryByText(".header")).not.toBeInTheDocument();
|
|
83
80
|
});
|
|
84
81
|
});
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
1
|
+
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
4
2
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
5
5
|
import QualityControlsHistory from "../QualityControlHistory";
|
|
6
|
-
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
7
6
|
|
|
8
7
|
const renderOpts = { messages };
|
|
9
8
|
|
|
10
9
|
describe("<QualityControlsHistory />", () => {
|
|
11
10
|
it("matches the latest snapshot", async () => {
|
|
12
11
|
const context = { qualityControl: qualityControlData() };
|
|
13
|
-
const
|
|
12
|
+
const rendered = render(
|
|
14
13
|
<TestFormWrapper context={context}>
|
|
15
14
|
<QualityControlsHistory />
|
|
16
15
|
</TestFormWrapper>,
|
|
17
16
|
renderOpts
|
|
18
17
|
);
|
|
19
|
-
|
|
18
|
+
await waitForLoad(rendered);
|
|
19
|
+
expect(rendered.container).toMatchSnapshot();
|
|
20
20
|
});
|
|
21
21
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
|
-
import { fireEvent } from "@testing-library/react";
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
3
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
5
4
|
import QualityControlQueryModal from "../QualityControlQueryModal";
|
|
6
5
|
|
|
@@ -56,22 +55,24 @@ jest.mock("@truedat/qx/hooks/useQualityControls", () => {
|
|
|
56
55
|
const renderOpts = { messages };
|
|
57
56
|
|
|
58
57
|
describe("<QualityControlQueryModal />", () => {
|
|
59
|
-
it("matches the latest snapshot", () => {
|
|
60
|
-
const
|
|
58
|
+
it("matches the latest snapshot", async () => {
|
|
59
|
+
const rendered = render(
|
|
61
60
|
<QualityControlQueryModal qualityControlId={8} />,
|
|
62
61
|
renderOpts
|
|
63
62
|
);
|
|
64
|
-
|
|
65
|
-
expect(container).toMatchSnapshot();
|
|
63
|
+
await waitForLoad(rendered);
|
|
64
|
+
expect(rendered.container).toMatchSnapshot();
|
|
66
65
|
});
|
|
67
66
|
|
|
68
|
-
it("open modal", () => {
|
|
69
|
-
const {
|
|
67
|
+
it("open modal", async () => {
|
|
68
|
+
const user = userEvent.setup({ delay: null });
|
|
69
|
+
const rendered = render(
|
|
70
70
|
<QualityControlQueryModal qualityControlId={8} />,
|
|
71
71
|
renderOpts
|
|
72
72
|
);
|
|
73
|
+
await waitForLoad(rendered);
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
expect(container).toMatchSnapshot();
|
|
75
|
+
await user.click(rendered.getByRole("button"));
|
|
76
|
+
expect(rendered.container).toMatchSnapshot();
|
|
76
77
|
});
|
|
77
78
|
});
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render } from "@truedat/test/render";
|
|
3
2
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
4
3
|
import { columns } from "../QualityControlsTable";
|
|
5
4
|
import QualityControlRow from "../QualityControlRow";
|
|
6
5
|
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
7
6
|
|
|
8
|
-
const
|
|
9
|
-
push: jest.fn(),
|
|
10
|
-
};
|
|
7
|
+
const mockNavigate = jest.fn();
|
|
11
8
|
|
|
12
|
-
jest.mock("react-router
|
|
13
|
-
...jest.requireActual("react-router
|
|
14
|
-
|
|
9
|
+
jest.mock("react-router", () => ({
|
|
10
|
+
...jest.requireActual("react-router"),
|
|
11
|
+
useNavigate: () => mockNavigate,
|
|
15
12
|
}));
|
|
16
13
|
|
|
17
14
|
const renderOpts = {
|
|
18
15
|
messages,
|
|
19
|
-
fallback: "lazy",
|
|
20
16
|
};
|
|
21
17
|
|
|
22
18
|
const props = {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
4
1
|
import { waitFor } from "@testing-library/react";
|
|
5
2
|
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
6
4
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
7
5
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
8
6
|
import {
|
|
@@ -12,8 +10,8 @@ import {
|
|
|
12
10
|
import QualityControlScores from "../QualityControlScores";
|
|
13
11
|
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
14
12
|
|
|
15
|
-
jest.mock("react-router
|
|
16
|
-
...jest.requireActual("react-router
|
|
13
|
+
jest.mock("react-router", () => ({
|
|
14
|
+
...jest.requireActual("react-router"),
|
|
17
15
|
useParams: () => ({ id: "8", version: "1" }),
|
|
18
16
|
}));
|
|
19
17
|
|
|
@@ -51,18 +49,18 @@ const context = {
|
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
describe("<QualityControlScores />", () => {
|
|
54
|
-
it("matches the latest snapshot", () => {
|
|
55
|
-
const
|
|
52
|
+
it("matches the latest snapshot", async () => {
|
|
53
|
+
const rendered = render(
|
|
56
54
|
<TestFormWrapper context={context}>
|
|
57
55
|
<QualityControlScores />
|
|
58
56
|
</TestFormWrapper>,
|
|
59
57
|
renderOpts
|
|
60
58
|
);
|
|
61
|
-
|
|
62
|
-
expect(container).toMatchSnapshot();
|
|
59
|
+
await waitForLoad(rendered);
|
|
60
|
+
expect(rendered.container).toMatchSnapshot();
|
|
63
61
|
});
|
|
64
62
|
|
|
65
|
-
it("shows a message when there are no scores", () => {
|
|
63
|
+
it("shows a message when there are no scores", async () => {
|
|
66
64
|
useQualityControlScores.mockReturnValueOnce({
|
|
67
65
|
data: { data: [] },
|
|
68
66
|
loading: false,
|
|
@@ -76,17 +74,18 @@ describe("<QualityControlScores />", () => {
|
|
|
76
74
|
mutate,
|
|
77
75
|
};
|
|
78
76
|
|
|
79
|
-
const
|
|
77
|
+
const rendered = render(
|
|
80
78
|
<TestFormWrapper context={context}>
|
|
81
79
|
<QualityControlScores />
|
|
82
80
|
</TestFormWrapper>,
|
|
83
81
|
renderOpts
|
|
84
82
|
);
|
|
83
|
+
await waitForLoad(rendered);
|
|
85
84
|
|
|
86
|
-
expect(getByText(
|
|
85
|
+
expect(rendered.getByText(/no scores found/i)).toBeInTheDocument();
|
|
87
86
|
});
|
|
88
87
|
|
|
89
|
-
it("does not show delete button when user does not have delete_score action", () => {
|
|
88
|
+
it("does not show delete button when user does not have delete_score action", async () => {
|
|
90
89
|
const context = {
|
|
91
90
|
qualityControl: qualityControlData(),
|
|
92
91
|
loading: false,
|
|
@@ -94,14 +93,15 @@ describe("<QualityControlScores />", () => {
|
|
|
94
93
|
mutate,
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
const
|
|
96
|
+
const rendered = render(
|
|
98
97
|
<TestFormWrapper context={context}>
|
|
99
98
|
<QualityControlScores />
|
|
100
99
|
</TestFormWrapper>,
|
|
101
100
|
renderOpts
|
|
102
101
|
);
|
|
102
|
+
await waitForLoad(rendered);
|
|
103
103
|
|
|
104
|
-
const deleteButtons = container.querySelectorAll(
|
|
104
|
+
const deleteButtons = rendered.container.querySelectorAll(
|
|
105
105
|
".ui.red.basic.icon.button"
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -119,19 +119,23 @@ describe("<QualityControlScores />", () => {
|
|
|
119
119
|
trigger,
|
|
120
120
|
}));
|
|
121
121
|
|
|
122
|
-
const {
|
|
122
|
+
const user = userEvent.setup({ delay: null });
|
|
123
|
+
|
|
124
|
+
const rendered = render(
|
|
123
125
|
<TestFormWrapper context={context}>
|
|
124
126
|
<QualityControlScores />
|
|
125
127
|
</TestFormWrapper>,
|
|
126
128
|
renderOpts
|
|
127
129
|
);
|
|
130
|
+
await waitForLoad(rendered);
|
|
128
131
|
|
|
129
|
-
const deleteButtons = container.querySelectorAll(
|
|
132
|
+
const deleteButtons = rendered.container.querySelectorAll(
|
|
130
133
|
".ui.red.basic.icon.button"
|
|
131
134
|
);
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
await user.click(deleteButtons[0]);
|
|
137
|
+
await user.click(rendered.getByText(/confirm_yes/i));
|
|
138
|
+
|
|
135
139
|
await waitFor(() => {
|
|
136
140
|
expect(trigger).toHaveBeenCalled();
|
|
137
141
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render } from "@truedat/test/render";
|
|
3
2
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
4
3
|
import QualityControlTabs from "../QualityControlTabs";
|
|
5
4
|
|
|
6
|
-
jest.mock("react-router
|
|
7
|
-
...jest.requireActual("react-router
|
|
5
|
+
jest.mock("react-router", () => ({
|
|
6
|
+
...jest.requireActual("react-router"),
|
|
8
7
|
useParams: () => ({ id: "8", version: "1" }),
|
|
9
8
|
useLocation: () => ({ pathname: "/qualityControls/8/version/1" }),
|
|
10
9
|
}));
|