@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,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import userEvent from "@testing-library/user-event";
|
|
3
2
|
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
4
5
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
5
6
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
6
|
-
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
7
7
|
import ControlProperties, { defaultForMode } from "../ControlProperties";
|
|
8
8
|
|
|
9
9
|
const dataSet = {
|
|
@@ -11,6 +11,7 @@ const dataSet = {
|
|
|
11
11
|
name: "dataset1",
|
|
12
12
|
headers: ["campo1", "campo2"],
|
|
13
13
|
};
|
|
14
|
+
|
|
14
15
|
const referenceDatasetsMock = {
|
|
15
16
|
request: { query: REFERENCE_DATASETS_HEADERS_QUERY },
|
|
16
17
|
result: { data: { referenceDatasets: [dataSet], loading: false } },
|
|
@@ -19,7 +20,6 @@ const referenceDatasetsMock = {
|
|
|
19
20
|
const renderOpts = {
|
|
20
21
|
mocks: [referenceDatasetsMock],
|
|
21
22
|
messages,
|
|
22
|
-
fallback: "lazy",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const defaultValues = {
|
|
@@ -35,40 +35,35 @@ const defaultValues = {
|
|
|
35
35
|
|
|
36
36
|
describe("<ControlProperties />", () => {
|
|
37
37
|
it("matches the latest snapshot with ratio", async () => {
|
|
38
|
-
const
|
|
38
|
+
const rendered = render(
|
|
39
39
|
<TestFormWrapper defaultValues={defaultValues}>
|
|
40
40
|
<ControlProperties />
|
|
41
41
|
</TestFormWrapper>,
|
|
42
42
|
renderOpts
|
|
43
43
|
);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
expect(container.querySelector(".loader")).not.toBeInTheDocument()
|
|
47
|
-
);
|
|
48
|
-
expect(container).toMatchSnapshot();
|
|
44
|
+
await waitForLoad(rendered);
|
|
45
|
+
expect(rendered.container).toMatchSnapshot();
|
|
49
46
|
});
|
|
50
47
|
|
|
51
|
-
it("matches the latest snapshot with
|
|
52
|
-
const
|
|
48
|
+
it("matches the latest snapshot with count", async () => {
|
|
49
|
+
const countDefaultValues = {
|
|
53
50
|
...defaultValues,
|
|
54
|
-
control_mode: "
|
|
51
|
+
control_mode: "count",
|
|
55
52
|
};
|
|
56
|
-
const
|
|
57
|
-
<TestFormWrapper defaultValues={
|
|
53
|
+
const rendered = render(
|
|
54
|
+
<TestFormWrapper defaultValues={countDefaultValues}>
|
|
58
55
|
<ControlProperties />
|
|
59
56
|
</TestFormWrapper>,
|
|
60
57
|
renderOpts
|
|
61
58
|
);
|
|
62
|
-
await
|
|
63
|
-
|
|
64
|
-
);
|
|
65
|
-
expect(container).toMatchSnapshot();
|
|
59
|
+
await waitForLoad(rendered);
|
|
60
|
+
expect(rendered.container).toMatchSnapshot();
|
|
66
61
|
});
|
|
67
62
|
});
|
|
68
63
|
|
|
69
64
|
describe("defaultForMode", () => {
|
|
70
|
-
it("returns correct default for '
|
|
71
|
-
const result = defaultForMode("
|
|
65
|
+
it("returns correct default for 'count' control mode", () => {
|
|
66
|
+
const result = defaultForMode("count");
|
|
72
67
|
expect(result).toEqual({ errors_resource: null });
|
|
73
68
|
});
|
|
74
69
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render } from "@truedat/test/render";
|
|
3
2
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
4
3
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
@@ -20,10 +19,10 @@ describe("<ControlPropertiesView />", () => {
|
|
|
20
19
|
expect(container).toMatchSnapshot();
|
|
21
20
|
});
|
|
22
21
|
|
|
23
|
-
it("matches the latest snapshot for
|
|
24
|
-
const
|
|
22
|
+
it("matches the latest snapshot for count", async () => {
|
|
23
|
+
const countQualityControl = {
|
|
25
24
|
...qualityControl,
|
|
26
|
-
control_mode: "
|
|
25
|
+
control_mode: "count",
|
|
27
26
|
control_properties: {
|
|
28
27
|
errors_resource: {
|
|
29
28
|
id: 11859650,
|
|
@@ -33,7 +32,7 @@ describe("<ControlPropertiesView />", () => {
|
|
|
33
32
|
};
|
|
34
33
|
const { container } = render(
|
|
35
34
|
<TestFormWrapper>
|
|
36
|
-
<ControlPropertiesView qualityControl={
|
|
35
|
+
<ControlPropertiesView qualityControl={countQualityControl} />
|
|
37
36
|
</TestFormWrapper>,
|
|
38
37
|
renderOpts
|
|
39
38
|
);
|
|
@@ -58,7 +57,7 @@ describe("<ControlPropertiesView />", () => {
|
|
|
58
57
|
<ControlPropertiesView
|
|
59
58
|
qualityControl={{
|
|
60
59
|
...qualityControl,
|
|
61
|
-
control_mode: "
|
|
60
|
+
control_mode: "count",
|
|
62
61
|
control_properties: { errors_resource: null },
|
|
63
62
|
}}
|
|
64
63
|
/>
|
|
@@ -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
|
});
|