@truedat/dq 4.33.10 → 4.35.2
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/CHANGELOG.md +26 -0
- package/package.json +5 -5
- package/src/api.js +7 -1
- package/src/components/ConditionSummary.js +23 -21
- package/src/components/ExecutionDetails.js +11 -14
- package/src/components/ExecutionGroup.js +24 -15
- package/src/components/ImplementationResultBar.js +80 -0
- package/src/components/ImplementationSummary.js +33 -72
- package/src/components/ImplementationsUploadButton.js +61 -0
- package/src/components/InformationSummary.js +68 -0
- package/src/components/NewRuleImplementation.js +12 -0
- package/src/components/RuleForm.js +0 -178
- package/src/components/RuleImplementation.js +10 -6
- package/src/components/RuleImplementationProperties.js +31 -64
- package/src/components/RuleImplementationResults.js +87 -53
- package/src/components/RuleImplementationsActions.js +3 -59
- package/src/components/RuleImplementationsDownload.js +86 -0
- package/src/components/RuleImplementationsOptions.js +28 -0
- package/src/components/RuleProperties.js +1 -10
- package/src/components/RuleResultDecorator.js +43 -26
- package/src/components/RuleResultRow.js +4 -1
- package/src/components/RuleResultsUpload.js +47 -0
- package/src/components/RuleRoutes.js +0 -13
- package/src/components/RuleSummary.js +15 -2
- package/src/components/RulesActions.js +17 -10
- package/src/components/RulesUploadButton.js +58 -0
- package/src/components/__tests__/ExecutionGroup.spec.js +11 -7
- package/src/components/__tests__/ImplementationResultBar.spec.js +98 -0
- package/src/components/__tests__/ImplementationSummary.spec.js +9 -26
- package/src/components/__tests__/InformationSummary.spec.js +35 -0
- package/src/components/__tests__/NewRuleImplementation.spec.js +1 -1
- package/src/components/__tests__/RuleForm.spec.js +0 -191
- package/src/components/__tests__/RuleImplementation.spec.js +1 -0
- package/src/components/__tests__/RuleImplementationProperties.spec.js +23 -33
- package/src/components/__tests__/RuleImplementationsActions.spec.js +0 -9
- package/src/components/__tests__/RuleImplementationsOptions.spec.js +18 -0
- package/src/components/__tests__/RuleProperties.spec.js +7 -9
- package/src/components/__tests__/RuleResultDecorator.spec.js +17 -11
- package/src/components/__tests__/RuleResultRow.spec.js +25 -46
- package/src/components/__tests__/RuleResultsUpload.spec.js +18 -0
- package/src/components/__tests__/RuleRow.spec.js +0 -4
- package/src/components/__tests__/RuleSummary.spec.js +6 -6
- package/src/components/__tests__/Rules.spec.js +15 -39
- package/src/components/__tests__/__snapshots__/ConditionSummary.spec.js.snap +55 -51
- package/src/components/__tests__/__snapshots__/ExecutionGroup.spec.js.snap +5 -4
- package/src/components/__tests__/__snapshots__/ImplementationResultBar.spec.js.snap +141 -0
- package/src/components/__tests__/__snapshots__/ImplementationSummary.spec.js.snap +194 -457
- package/src/components/__tests__/__snapshots__/InformationSummary.spec.js.snap +185 -0
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +6 -0
- package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +0 -148
- package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +20 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +43 -49
- package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +63 -61
- package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +1 -7
- package/src/components/__tests__/__snapshots__/RuleImplementationsOptions.spec.js.snap +58 -0
- package/src/components/__tests__/__snapshots__/RuleProperties.spec.js.snap +0 -1
- package/src/components/__tests__/__snapshots__/RuleResultsUpload.spec.js.snap +18 -0
- package/src/components/__tests__/__snapshots__/RuleRow.spec.js.snap +0 -28
- package/src/components/__tests__/__snapshots__/Rules.spec.js.snap +0 -101
- package/src/components/ruleImplementationForm/FiltersGroup.js +1 -0
- package/src/components/ruleImplementationForm/InformationForm.js +5 -5
- package/src/components/ruleImplementationForm/LimitsForm.js +142 -0
- package/src/components/ruleImplementationForm/RuleImplementationForm.js +14 -4
- package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +16 -6
- package/src/components/ruleImplementationForm/ValueConditions.js +11 -0
- package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +186 -0
- package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +42 -35
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/LimitsForm.spec.js.snap +1104 -0
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +4 -1
- package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +12 -1
- package/src/components/ruleImplementationForm/limitsValidation.js +72 -0
- package/src/messages/en.js +167 -76
- package/src/messages/es.js +292 -185
- package/src/reducers/__tests__/rule.spec.js +2 -4
- package/src/reducers/__tests__/ruleImplementation.spec.js +2 -0
- package/src/reducers/__tests__/ruleImplementations.spec.js +12 -8
- package/src/reducers/__tests__/uploadingResults.spec.js +28 -0
- package/src/reducers/dqMessage.js +121 -1
- package/src/reducers/index.js +6 -0
- package/src/reducers/rule.js +0 -3
- package/src/reducers/ruleImplementation.js +3 -0
- package/src/reducers/ruleImplementationRedirect.js +6 -1
- package/src/reducers/ruleImplementations.js +3 -0
- package/src/reducers/ruleRedirect.js +5 -0
- package/src/reducers/uploadImplementationsFile.js +28 -0
- package/src/reducers/uploadRulesFile.js +25 -0
- package/src/reducers/uploadingResults.js +16 -0
- package/src/routines.js +3 -0
- package/src/sagas/__tests__/uploadResults.spec.js +65 -0
- package/src/sagas/index.js +9 -0
- package/src/sagas/uploadImplementations.js +28 -0
- package/src/sagas/uploadResults.js +32 -0
- package/src/sagas/uploadRules.js +28 -0
- package/src/selectors/getRuleImplementationColumns.js +38 -3
- package/src/selectors/ruleColumnsSelector.js +0 -31
- package/src/styles/ruleSummary.less +17 -10
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ImplementationResultBar from "../ImplementationResultBar";
|
|
4
|
+
import messages from "../../messages/en";
|
|
5
|
+
|
|
6
|
+
describe("<ImplementationResultBar />", () => {
|
|
7
|
+
const renderOpts = {
|
|
8
|
+
messages: { en: messages },
|
|
9
|
+
};
|
|
10
|
+
const base = {
|
|
11
|
+
id: 1,
|
|
12
|
+
rule_id: 8,
|
|
13
|
+
goal: 80,
|
|
14
|
+
minimum: 50,
|
|
15
|
+
result_type: "percentage",
|
|
16
|
+
};
|
|
17
|
+
const overGoalProps = {
|
|
18
|
+
implementation: {
|
|
19
|
+
...base,
|
|
20
|
+
results: [{ date: "2021-07-19T00:01:20Z", result: "99.99" }],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const underGoalProps = {
|
|
24
|
+
implementation: {
|
|
25
|
+
...base,
|
|
26
|
+
results: [{ date: "2021-07-19T00:01:20Z", result: "70" }],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const underMinimumProps = {
|
|
30
|
+
implementation: {
|
|
31
|
+
...base,
|
|
32
|
+
results: [{ date: "2021-07-19T00:01:20Z", result: "40" }],
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const notExecutedProps = {
|
|
36
|
+
implementation: {
|
|
37
|
+
...base,
|
|
38
|
+
results: [],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const failedProps = {
|
|
42
|
+
implementation: {
|
|
43
|
+
...base,
|
|
44
|
+
results: [],
|
|
45
|
+
event_type: "FAILED",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
it("render overGoal implementation", () => {
|
|
50
|
+
const { container } = render(
|
|
51
|
+
<ImplementationResultBar {...overGoalProps} />,
|
|
52
|
+
renderOpts
|
|
53
|
+
);
|
|
54
|
+
expect(container).toMatchSnapshot();
|
|
55
|
+
expect(container.querySelector(".over-goal-color")).not.toBeNull();
|
|
56
|
+
expect(container).toHaveTextContent("99.99% at 2021-07-19 00:01");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("render underGoal implementation", () => {
|
|
60
|
+
const { container } = render(
|
|
61
|
+
<ImplementationResultBar {...underGoalProps} />,
|
|
62
|
+
renderOpts
|
|
63
|
+
);
|
|
64
|
+
expect(container).toMatchSnapshot();
|
|
65
|
+
expect(container.querySelector(".under-goal-color")).not.toBeNull();
|
|
66
|
+
expect(container).toHaveTextContent("70% at 2021-07-19 00:01");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("render underMinimum implementation", () => {
|
|
70
|
+
const { container } = render(
|
|
71
|
+
<ImplementationResultBar {...underMinimumProps} />,
|
|
72
|
+
renderOpts
|
|
73
|
+
);
|
|
74
|
+
expect(container).toMatchSnapshot();
|
|
75
|
+
expect(container.querySelector(".under-minimum-color")).not.toBeNull();
|
|
76
|
+
expect(container).toHaveTextContent("40% at 2021-07-19 00:01");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("render not executed implementation", () => {
|
|
80
|
+
const { container } = render(
|
|
81
|
+
<ImplementationResultBar {...notExecutedProps} />,
|
|
82
|
+
renderOpts
|
|
83
|
+
);
|
|
84
|
+
expect(container).toMatchSnapshot();
|
|
85
|
+
expect(container.querySelector(".not-executed-color")).not.toBeNull();
|
|
86
|
+
expect(container).toHaveTextContent("No information about quality");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("render failed implementation", () => {
|
|
90
|
+
const { container } = render(
|
|
91
|
+
<ImplementationResultBar {...failedProps} />,
|
|
92
|
+
renderOpts
|
|
93
|
+
);
|
|
94
|
+
expect(container).toMatchSnapshot();
|
|
95
|
+
expect(container.querySelector(".failed-color")).not.toBeNull();
|
|
96
|
+
expect(container).toHaveTextContent("Latest execution failed");
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -7,6 +7,12 @@ import { ImplementationSummary } from "../ImplementationSummary";
|
|
|
7
7
|
const renderOpts = {
|
|
8
8
|
messages: {
|
|
9
9
|
en: {
|
|
10
|
+
"ruleImplementationForm.step.information": "information",
|
|
11
|
+
"quality.thresholds": "thresholds",
|
|
12
|
+
"quality.threshold": "threshold",
|
|
13
|
+
"quality.goal": "goal",
|
|
14
|
+
"ruleImplementations.props.result_type.percentage": "percentage",
|
|
15
|
+
|
|
10
16
|
"ruleImplementation.summary.field": "Field",
|
|
11
17
|
"ruleImplementation.summary.operator": "Operator",
|
|
12
18
|
"ruleImplementation.summary.structure": "Structure",
|
|
@@ -47,6 +53,9 @@ const ruleImplementation = {
|
|
|
47
53
|
value: [{ raw: ["4", "5", "6"] }],
|
|
48
54
|
},
|
|
49
55
|
],
|
|
56
|
+
goal: 50,
|
|
57
|
+
minimum: 10,
|
|
58
|
+
result_type: "percentage",
|
|
50
59
|
implementationType: "",
|
|
51
60
|
rawContent: { system: "", dataset: "", population: "", validations: "" },
|
|
52
61
|
};
|
|
@@ -82,32 +91,6 @@ describe("<ImplementationSummary />", () => {
|
|
|
82
91
|
expect(queryByText('"4, 5, 6"')).not.toBeNull();
|
|
83
92
|
});
|
|
84
93
|
|
|
85
|
-
it("displays correctly general summary", () => {
|
|
86
|
-
const props = {
|
|
87
|
-
ruleImplementation,
|
|
88
|
-
};
|
|
89
|
-
const { container, queryByText } = render(
|
|
90
|
-
<ImplementationSummary {...props} />,
|
|
91
|
-
renderOpts
|
|
92
|
-
);
|
|
93
|
-
expect(container).toMatchSnapshot();
|
|
94
|
-
expect(queryByText("Executable")).not.toBeNull();
|
|
95
|
-
expect(queryByText('"ImplKey"')).not.toBeNull();
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it("renders executable as internal when it is false", () => {
|
|
99
|
-
const props = {
|
|
100
|
-
ruleImplementation: { ...ruleImplementation, executable: false },
|
|
101
|
-
};
|
|
102
|
-
const { container, queryByText } = render(
|
|
103
|
-
<ImplementationSummary {...props} />,
|
|
104
|
-
renderOpts
|
|
105
|
-
);
|
|
106
|
-
expect(container).toMatchSnapshot();
|
|
107
|
-
expect(queryByText("Internal")).not.toBeNull();
|
|
108
|
-
expect(queryByText('"ImplKey"')).not.toBeNull();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
94
|
it("getValues returns array of values that contain required keys and adds optional keys for operator with field value_type", () => {
|
|
112
95
|
expect(
|
|
113
96
|
getValues({
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import InformationSummary from "../InformationSummary";
|
|
4
|
+
import messages from "../../messages/en";
|
|
5
|
+
|
|
6
|
+
describe("<InformationSummary />", () => {
|
|
7
|
+
const renderOpts = {
|
|
8
|
+
messages: { en: messages },
|
|
9
|
+
};
|
|
10
|
+
const ruleImplementation = {
|
|
11
|
+
id: 1,
|
|
12
|
+
rule_id: 8,
|
|
13
|
+
goal: 80,
|
|
14
|
+
minimum: 50,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it("renders percentage result_type", () => {
|
|
18
|
+
const props = {
|
|
19
|
+
ruleImplementation: { ...ruleImplementation, result_type: "percentage" },
|
|
20
|
+
};
|
|
21
|
+
const { container } = render(<InformationSummary {...props} />, renderOpts);
|
|
22
|
+
expect(container).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("renders errors_number result_type", () => {
|
|
26
|
+
const props = {
|
|
27
|
+
ruleImplementation: {
|
|
28
|
+
...ruleImplementation,
|
|
29
|
+
result_type: "errors_number",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const { container } = render(<InformationSummary {...props} />, renderOpts);
|
|
33
|
+
expect(container).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -23,8 +23,6 @@ describe("<RuleForm />", () => {
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
current_business_concept_version: { name: "My Concept" },
|
|
26
|
-
goal: 10,
|
|
27
|
-
minimum: 1,
|
|
28
26
|
};
|
|
29
27
|
const handleSubmit = jest.fn();
|
|
30
28
|
const selectDomain = jest.fn();
|
|
@@ -52,9 +50,6 @@ describe("<RuleForm />", () => {
|
|
|
52
50
|
const eventMock = {
|
|
53
51
|
preventDefault: jest.fn(),
|
|
54
52
|
};
|
|
55
|
-
|
|
56
|
-
const findLabel = (wrapper, field) =>
|
|
57
|
-
wrapper.find("FieldLabelWrapping").find({ label: `rule.props.${field}` });
|
|
58
53
|
const findField = (wrapper, name) => wrapper.find({ name });
|
|
59
54
|
|
|
60
55
|
it("matches the latest snapshot for editMode", () => {
|
|
@@ -112,192 +107,6 @@ describe("<RuleForm />", () => {
|
|
|
112
107
|
expect(handleSubmit.mock.calls.length).toBe(1);
|
|
113
108
|
});
|
|
114
109
|
|
|
115
|
-
it("shows and hides required label", () => {
|
|
116
|
-
const wrapper = shallowWithIntl(<RuleForm {...defaultProps} />);
|
|
117
|
-
|
|
118
|
-
const requiredValidation = "rule.form.validation.empty_required";
|
|
119
|
-
|
|
120
|
-
const testLabelOnChange = (name, value) => {
|
|
121
|
-
expect(findLabel(wrapper, name).props().messages).toEqual([
|
|
122
|
-
requiredValidation,
|
|
123
|
-
]);
|
|
124
|
-
findField(wrapper, name).simulate("change", eventMock, { name, value });
|
|
125
|
-
expect(findLabel(wrapper, name).props().messages).toEqual(undefined);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
testLabelOnChange("name", "value");
|
|
129
|
-
testLabelOnChange("minimum", "2");
|
|
130
|
-
testLabelOnChange("goal", "3");
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("doesnt change goal and minimum fields values when not valid number", () => {
|
|
134
|
-
const wrapper = shallowWithIntl(<RuleForm {...defaultProps} />);
|
|
135
|
-
|
|
136
|
-
const testValueOnChange = (name, beforeValue, value, expectedValue) => {
|
|
137
|
-
expect(findField(wrapper, name).props().value).toEqual(beforeValue);
|
|
138
|
-
findField(wrapper, name).simulate("change", eventMock, { name, value });
|
|
139
|
-
expect(findField(wrapper, name).props().value).toEqual(expectedValue);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
testValueOnChange("minimum", "", "invalid", "");
|
|
143
|
-
testValueOnChange("minimum", "", "4", 4);
|
|
144
|
-
testValueOnChange("minimum", 4, "invalid", 4);
|
|
145
|
-
testValueOnChange("minimum", 4, "", "");
|
|
146
|
-
testValueOnChange("goal", "", "invalid", "");
|
|
147
|
-
testValueOnChange("goal", "", "5", 5);
|
|
148
|
-
testValueOnChange("goal", 5, "invalid", 5);
|
|
149
|
-
testValueOnChange("goal", 5, "", "");
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it("shows correct messages for minimum and goal number ranges", () => {
|
|
153
|
-
const wrapper = shallowWithIntl(<RuleForm {...defaultProps} />);
|
|
154
|
-
|
|
155
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
156
|
-
name: "goal",
|
|
157
|
-
value: "4",
|
|
158
|
-
});
|
|
159
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual(undefined);
|
|
160
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
161
|
-
name: "goal",
|
|
162
|
-
value: "101",
|
|
163
|
-
});
|
|
164
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual([
|
|
165
|
-
"rule.form.validation.max_goal",
|
|
166
|
-
]);
|
|
167
|
-
|
|
168
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
169
|
-
name: "minimum",
|
|
170
|
-
value: "5",
|
|
171
|
-
});
|
|
172
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
173
|
-
name: "goal",
|
|
174
|
-
value: "10",
|
|
175
|
-
});
|
|
176
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual(undefined);
|
|
177
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual(undefined);
|
|
178
|
-
|
|
179
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
180
|
-
name: "minimum",
|
|
181
|
-
value: "15",
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual([
|
|
185
|
-
"rule.form.validation.minimum_greater",
|
|
186
|
-
]);
|
|
187
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual([
|
|
188
|
-
"rule.form.validation.goal_less",
|
|
189
|
-
]);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it("shows correct messages for minimum and goal number ranges in a Rule with result_type deviation", () => {
|
|
193
|
-
const props = {
|
|
194
|
-
rule: { ...rule, result_type: "deviation" },
|
|
195
|
-
handleSubmit,
|
|
196
|
-
templatesLoaded,
|
|
197
|
-
isSubmitting,
|
|
198
|
-
template,
|
|
199
|
-
business_concept_id,
|
|
200
|
-
applyTemplate: applyTemplate(template),
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const wrapper = shallowWithIntl(<RuleForm {...props} />);
|
|
204
|
-
|
|
205
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
206
|
-
name: "goal",
|
|
207
|
-
value: "11",
|
|
208
|
-
});
|
|
209
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual([
|
|
210
|
-
"rule.form.validation.goal.less_eq.minimum",
|
|
211
|
-
]);
|
|
212
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
213
|
-
name: "goal",
|
|
214
|
-
value: "0",
|
|
215
|
-
});
|
|
216
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual(undefined);
|
|
217
|
-
|
|
218
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
219
|
-
name: "minimum",
|
|
220
|
-
value: "70",
|
|
221
|
-
});
|
|
222
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
223
|
-
name: "goal",
|
|
224
|
-
value: "80",
|
|
225
|
-
});
|
|
226
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual([
|
|
227
|
-
"rule.form.validation.minimum.greater_eq.goal",
|
|
228
|
-
]);
|
|
229
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual([
|
|
230
|
-
"rule.form.validation.goal.less_eq.minimum",
|
|
231
|
-
]);
|
|
232
|
-
|
|
233
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
234
|
-
name: "minimum",
|
|
235
|
-
value: "90",
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual(undefined);
|
|
239
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual(undefined);
|
|
240
|
-
|
|
241
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
242
|
-
name: "minimum",
|
|
243
|
-
value: "101",
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual([
|
|
247
|
-
"rule.form.validation.max_minimum",
|
|
248
|
-
]);
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it("shows correct messages for minimum and goal number ranges in a Rule with result_type numeric", () => {
|
|
252
|
-
const props = {
|
|
253
|
-
rule: { ...rule, result_type: "errors_number" },
|
|
254
|
-
handleSubmit,
|
|
255
|
-
templatesLoaded,
|
|
256
|
-
isSubmitting,
|
|
257
|
-
template,
|
|
258
|
-
business_concept_id,
|
|
259
|
-
applyTemplate: applyTemplate(template),
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
const wrapper = shallowWithIntl(<RuleForm {...props} />);
|
|
263
|
-
|
|
264
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
265
|
-
name: "goal",
|
|
266
|
-
value: "4",
|
|
267
|
-
});
|
|
268
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual([
|
|
269
|
-
"rule.form.validation.goal.less_eq.minimum",
|
|
270
|
-
]);
|
|
271
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
272
|
-
name: "goal",
|
|
273
|
-
value: "1",
|
|
274
|
-
});
|
|
275
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual(undefined);
|
|
276
|
-
|
|
277
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
278
|
-
name: "minimum",
|
|
279
|
-
value: "5",
|
|
280
|
-
});
|
|
281
|
-
findField(wrapper, "goal").simulate("change", eventMock, {
|
|
282
|
-
name: "goal",
|
|
283
|
-
value: "10",
|
|
284
|
-
});
|
|
285
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual([
|
|
286
|
-
"rule.form.validation.minimum.greater_eq.goal",
|
|
287
|
-
]);
|
|
288
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual([
|
|
289
|
-
"rule.form.validation.goal.less_eq.minimum",
|
|
290
|
-
]);
|
|
291
|
-
|
|
292
|
-
findField(wrapper, "minimum").simulate("change", eventMock, {
|
|
293
|
-
name: "minimum",
|
|
294
|
-
value: "15",
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
expect(findLabel(wrapper, "minimum").props().messages).toEqual(undefined);
|
|
298
|
-
expect(findLabel(wrapper, "goal").props().messages).toEqual(undefined);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
110
|
it("handles correctly active field", () => {
|
|
302
111
|
const wrapper = shallowWithIntl(<RuleForm {...defaultProps} />);
|
|
303
112
|
|
|
@@ -8,10 +8,7 @@ describe("<RuleImplementationProperties />", () => {
|
|
|
8
8
|
rule: {
|
|
9
9
|
business_concept_id: "2D2B3",
|
|
10
10
|
description: "desc1",
|
|
11
|
-
goal: 10,
|
|
12
|
-
minimum: 1,
|
|
13
11
|
rule_type: { name: "type1" },
|
|
14
|
-
result_type: "percentage"
|
|
15
12
|
},
|
|
16
13
|
ruleImplementation: {
|
|
17
14
|
id: 10,
|
|
@@ -22,7 +19,7 @@ describe("<RuleImplementationProperties />", () => {
|
|
|
22
19
|
system: {
|
|
23
20
|
external_id: "Microstrategy",
|
|
24
21
|
id: 1,
|
|
25
|
-
name: "Microstrategy"
|
|
22
|
+
name: "Microstrategy",
|
|
26
23
|
},
|
|
27
24
|
system_params: {
|
|
28
25
|
table: { name: "aaaxxx" },
|
|
@@ -34,15 +31,18 @@ describe("<RuleImplementationProperties />", () => {
|
|
|
34
31
|
"Objetos Públicos",
|
|
35
32
|
"Informes",
|
|
36
33
|
"Validación",
|
|
37
|
-
"ACGC - 01.00 Análisis General Compañía"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
34
|
+
"ACGC - 01.00 Análisis General Compañía",
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
goal: 10,
|
|
39
|
+
minimum: 1,
|
|
40
|
+
result_type: "percentage",
|
|
41
41
|
},
|
|
42
42
|
ruleImplementationResults: [
|
|
43
43
|
{ date: "2019-08-12T02:00:00Z", result: 34 },
|
|
44
|
-
{ date: "2019-08-12T01:00:00Z", result: 33 }
|
|
45
|
-
]
|
|
44
|
+
{ date: "2019-08-12T01:00:00Z", result: 33 },
|
|
45
|
+
],
|
|
46
46
|
};
|
|
47
47
|
const wrapper = shallowWithIntl(
|
|
48
48
|
<RuleImplementationProperties {...props} />
|
|
@@ -55,10 +55,7 @@ describe("<RuleImplementationProperties />", () => {
|
|
|
55
55
|
rule: {
|
|
56
56
|
business_concept_id: "2D2B3",
|
|
57
57
|
description: "desc1",
|
|
58
|
-
goal: 10,
|
|
59
|
-
minimum: 1,
|
|
60
58
|
rule_type: { name: "type1" },
|
|
61
|
-
result_type: "percentage"
|
|
62
59
|
},
|
|
63
60
|
ruleImplementation: {
|
|
64
61
|
id: 10,
|
|
@@ -69,7 +66,7 @@ describe("<RuleImplementationProperties />", () => {
|
|
|
69
66
|
system: {
|
|
70
67
|
external_id: "Microstrategy",
|
|
71
68
|
id: 1,
|
|
72
|
-
name: "Microstrategy"
|
|
69
|
+
name: "Microstrategy",
|
|
73
70
|
},
|
|
74
71
|
system_params: {
|
|
75
72
|
table: { name: "aaaxxx" },
|
|
@@ -81,33 +78,26 @@ describe("<RuleImplementationProperties />", () => {
|
|
|
81
78
|
"Objetos Públicos",
|
|
82
79
|
"Informes",
|
|
83
80
|
"Validación",
|
|
84
|
-
"ACGC - 01.00 Análisis General Compañía"
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
}
|
|
81
|
+
"ACGC - 01.00 Análisis General Compañía",
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
goal: 10,
|
|
86
|
+
minimum: 1,
|
|
87
|
+
result_type: "percentage",
|
|
88
88
|
},
|
|
89
89
|
ruleImplementationResults: [
|
|
90
90
|
{ date: "2019-08-12T02:00:00Z", result: 34 },
|
|
91
|
-
{ date: "2019-08-12T01:00:00Z", result: 33 }
|
|
92
|
-
]
|
|
91
|
+
{ date: "2019-08-12T01:00:00Z", result: 33 },
|
|
92
|
+
],
|
|
93
93
|
};
|
|
94
94
|
const wrapper = shallowWithIntl(
|
|
95
95
|
<RuleImplementationProperties {...props} />
|
|
96
96
|
);
|
|
97
|
-
expect(
|
|
98
|
-
wrapper
|
|
99
|
-
.find("Label")
|
|
100
|
-
.at(0)
|
|
101
|
-
.prop("color")
|
|
102
|
-
).toEqual("olive");
|
|
97
|
+
expect(wrapper.find("Label").at(0).prop("color")).toEqual("olive");
|
|
103
98
|
wrapper.setProps({
|
|
104
|
-
ruleImplementation: { ...props.ruleImplementation, executable: false }
|
|
99
|
+
ruleImplementation: { ...props.ruleImplementation, executable: false },
|
|
105
100
|
});
|
|
106
|
-
expect(
|
|
107
|
-
wrapper
|
|
108
|
-
.find("Label")
|
|
109
|
-
.at(0)
|
|
110
|
-
.prop("color")
|
|
111
|
-
).toEqual("teal");
|
|
101
|
+
expect(wrapper.find("Label").at(0).prop("color")).toEqual("teal");
|
|
112
102
|
});
|
|
113
103
|
});
|
|
@@ -8,7 +8,6 @@ jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
|
8
8
|
|
|
9
9
|
describe("<RuleImplementationsActions />", () => {
|
|
10
10
|
const addImplementationFilter = jest.fn();
|
|
11
|
-
const downloadImplementations = jest.fn();
|
|
12
11
|
const toggleImplementationFilterValue = jest.fn();
|
|
13
12
|
const setMode = jest.fn();
|
|
14
13
|
const removeImplementationFilter = jest.fn();
|
|
@@ -17,9 +16,7 @@ describe("<RuleImplementationsActions />", () => {
|
|
|
17
16
|
executionGroupLoading: false,
|
|
18
17
|
ruleImplementationCount: 12,
|
|
19
18
|
implementationsExecution: true,
|
|
20
|
-
ruleImplementationsDownloading: false,
|
|
21
19
|
ruleImplementationsLoading: false,
|
|
22
|
-
downloadImplementations,
|
|
23
20
|
toggleImplementationFilterValue,
|
|
24
21
|
addImplementationFilter,
|
|
25
22
|
executeImplementationsOn: false,
|
|
@@ -31,12 +28,6 @@ describe("<RuleImplementationsActions />", () => {
|
|
|
31
28
|
expect(wrapper).toMatchSnapshot();
|
|
32
29
|
});
|
|
33
30
|
|
|
34
|
-
it("calls downloadImplementations on button click", () => {
|
|
35
|
-
const wrapper = shallow(<RuleImplementationsActions {...props} />);
|
|
36
|
-
wrapper.find("Button").simulate("click");
|
|
37
|
-
expect(downloadImplementations.mock.calls.length).toBe(1);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
31
|
it("as user with permissions I see execute implementations button and checkbox", () => {
|
|
41
32
|
const props = {
|
|
42
33
|
canExecute: true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { shallow } from "enzyme";
|
|
4
|
+
import { intl } from "@truedat/test/intl-stub";
|
|
5
|
+
import { RuleImplementationsOptions } from "../RuleImplementationsOptions";
|
|
6
|
+
|
|
7
|
+
jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
8
|
+
|
|
9
|
+
describe("<RuleImplementationsOptions />", () => {
|
|
10
|
+
it("matches the latest snapshot", () => {
|
|
11
|
+
const wrapper = shallow(<RuleImplementationsOptions />);
|
|
12
|
+
expect(wrapper).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
it("matches the latest loading snapshot", () => {
|
|
15
|
+
const wrapper = shallow(<RuleImplementationsOptions loading />);
|
|
16
|
+
expect(wrapper).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -3,12 +3,12 @@ import { shallowWithIntl } from "@truedat/test/intl-stub";
|
|
|
3
3
|
import { RuleProperties } from "../RuleProperties";
|
|
4
4
|
|
|
5
5
|
const mockHistory = {
|
|
6
|
-
push: jest.fn()
|
|
6
|
+
push: jest.fn(),
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
jest.mock("react-router-dom", () => ({
|
|
10
10
|
...jest.requireActual("react-router-dom"),
|
|
11
|
-
useHistory: () => mockHistory
|
|
11
|
+
useHistory: () => mockHistory,
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
14
|
describe("<RuleProperties />", () => {
|
|
@@ -24,14 +24,12 @@ describe("<RuleProperties />", () => {
|
|
|
24
24
|
nodes: [
|
|
25
25
|
{
|
|
26
26
|
data: {},
|
|
27
|
-
nodes: [{ marks: [{ data: {}, object: "text", text: "desc1" }] }]
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
27
|
+
nodes: [{ marks: [{ data: {}, object: "text", text: "desc1" }] }],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
minimum: 1,
|
|
34
|
-
rule_type: { name: "type1" }
|
|
32
|
+
rule_type: { name: "type1" },
|
|
35
33
|
};
|
|
36
34
|
const wrapper = shallowWithIntl(<RuleProperties {...props} />);
|
|
37
35
|
expect(wrapper).toMatchSnapshot();
|
|
@@ -7,8 +7,8 @@ describe("<RuleResultDecorator />", () => {
|
|
|
7
7
|
ruleResult: {
|
|
8
8
|
result: 42,
|
|
9
9
|
errors: 1234,
|
|
10
|
-
result_text: "result_text"
|
|
11
|
-
}
|
|
10
|
+
result_text: "result_text",
|
|
11
|
+
},
|
|
12
12
|
};
|
|
13
13
|
const renderOpts = {
|
|
14
14
|
messages: {
|
|
@@ -17,15 +17,18 @@ describe("<RuleResultDecorator />", () => {
|
|
|
17
17
|
no_data: "no_data_message",
|
|
18
18
|
"quality.result.percentage.description": "{result}%",
|
|
19
19
|
"quality.result.errors_number.description": "{result} errors",
|
|
20
|
-
"quality.result.no.data": "No data"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
20
|
+
"quality.result.no.data": "No data",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
it("decorates a percentage result", () => {
|
|
26
|
-
const
|
|
26
|
+
const ruleImplementation = { result_type: "percentage" };
|
|
27
27
|
const { container, queryByTitle } = render(
|
|
28
|
-
<RuleResultDecorator
|
|
28
|
+
<RuleResultDecorator
|
|
29
|
+
ruleImplementation={ruleImplementation}
|
|
30
|
+
{...props}
|
|
31
|
+
/>,
|
|
29
32
|
renderOpts
|
|
30
33
|
);
|
|
31
34
|
expect(container).toMatchSnapshot();
|
|
@@ -34,9 +37,12 @@ describe("<RuleResultDecorator />", () => {
|
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
it("decorates an error count result", () => {
|
|
37
|
-
const
|
|
40
|
+
const ruleImplementation = { result_type: "errors_number" };
|
|
38
41
|
const { container, queryByTitle } = render(
|
|
39
|
-
<RuleResultDecorator
|
|
42
|
+
<RuleResultDecorator
|
|
43
|
+
ruleImplementation={ruleImplementation}
|
|
44
|
+
{...props}
|
|
45
|
+
/>,
|
|
40
46
|
renderOpts
|
|
41
47
|
);
|
|
42
48
|
expect(container).toMatchSnapshot();
|
|
@@ -45,9 +51,9 @@ describe("<RuleResultDecorator />", () => {
|
|
|
45
51
|
});
|
|
46
52
|
|
|
47
53
|
it("decorates an implementation without result data", () => {
|
|
48
|
-
const
|
|
54
|
+
const ruleImplementation = { result_type: "errors_number" };
|
|
49
55
|
const ruleResult = { result_text: "no_data" };
|
|
50
|
-
const props = {
|
|
56
|
+
const props = { ruleImplementation, ruleResult };
|
|
51
57
|
const { container, queryByTitle } = render(
|
|
52
58
|
<RuleResultDecorator {...props} />,
|
|
53
59
|
renderOpts
|