@truedat/dq 4.33.7 → 4.34.0

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/package.json +5 -5
  3. package/src/components/ConditionSummary.js +23 -21
  4. package/src/components/ExecutionDetails.js +11 -14
  5. package/src/components/ExecutionForm.js +116 -0
  6. package/src/components/ExecutionGroup.js +24 -15
  7. package/src/components/ExecutionPopup.js +58 -0
  8. package/src/components/ImplementationResultBar.js +80 -0
  9. package/src/components/ImplementationSummary.js +33 -72
  10. package/src/components/ImplementationsRoutes.js +15 -5
  11. package/src/components/InformationSummary.js +68 -0
  12. package/src/components/NewRuleImplementation.js +12 -0
  13. package/src/components/RuleForm.js +0 -178
  14. package/src/components/RuleImplementation.js +10 -6
  15. package/src/components/RuleImplementationProperties.js +31 -64
  16. package/src/components/RuleImplementationResults.js +87 -53
  17. package/src/components/RuleImplementationsActions.js +10 -46
  18. package/src/components/RuleProperties.js +1 -10
  19. package/src/components/RuleResultDecorator.js +43 -26
  20. package/src/components/RuleResultRow.js +4 -1
  21. package/src/components/RuleRoutes.js +0 -13
  22. package/src/components/RuleSummary.js +15 -2
  23. package/src/components/__tests__/ExecutionForm.spec.js +25 -0
  24. package/src/components/__tests__/ExecutionGroup.spec.js +11 -7
  25. package/src/components/__tests__/ExecutionPopup.spec.js +20 -0
  26. package/src/components/__tests__/ImplementationResultBar.spec.js +98 -0
  27. package/src/components/__tests__/ImplementationSummary.spec.js +9 -26
  28. package/src/components/__tests__/InformationSummary.spec.js +35 -0
  29. package/src/components/__tests__/NewRuleImplementation.spec.js +1 -1
  30. package/src/components/__tests__/RuleForm.spec.js +0 -191
  31. package/src/components/__tests__/RuleImplementation.spec.js +1 -0
  32. package/src/components/__tests__/RuleImplementationProperties.spec.js +23 -33
  33. package/src/components/__tests__/RuleImplementationsActions.spec.js +10 -32
  34. package/src/components/__tests__/RuleProperties.spec.js +7 -9
  35. package/src/components/__tests__/RuleResultDecorator.spec.js +17 -11
  36. package/src/components/__tests__/RuleResultRow.spec.js +25 -46
  37. package/src/components/__tests__/RuleRow.spec.js +0 -4
  38. package/src/components/__tests__/RuleSummary.spec.js +6 -6
  39. package/src/components/__tests__/Rules.spec.js +15 -39
  40. package/src/components/__tests__/__snapshots__/ConditionSummary.spec.js.snap +55 -51
  41. package/src/components/__tests__/__snapshots__/ExecutionForm.spec.js.snap +33 -0
  42. package/src/components/__tests__/__snapshots__/ExecutionGroup.spec.js.snap +5 -4
  43. package/src/components/__tests__/__snapshots__/ExecutionPopup.spec.js.snap +11 -0
  44. package/src/components/__tests__/__snapshots__/ImplementationResultBar.spec.js.snap +141 -0
  45. package/src/components/__tests__/__snapshots__/ImplementationSummary.spec.js.snap +194 -457
  46. package/src/components/__tests__/__snapshots__/InformationSummary.spec.js.snap +185 -0
  47. package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +6 -0
  48. package/src/components/__tests__/__snapshots__/RuleForm.spec.js.snap +0 -148
  49. package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +20 -0
  50. package/src/components/__tests__/__snapshots__/RuleImplementationProperties.spec.js.snap +43 -49
  51. package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +63 -61
  52. package/src/components/__tests__/__snapshots__/RuleImplementationsActions.spec.js.snap +4 -49
  53. package/src/components/__tests__/__snapshots__/RuleProperties.spec.js.snap +0 -1
  54. package/src/components/__tests__/__snapshots__/RuleRow.spec.js.snap +0 -28
  55. package/src/components/__tests__/__snapshots__/Rules.spec.js.snap +0 -101
  56. package/src/components/ruleImplementationForm/InformationForm.js +5 -5
  57. package/src/components/ruleImplementationForm/LimitsForm.js +142 -0
  58. package/src/components/ruleImplementationForm/RuleImplementationForm.js +14 -4
  59. package/src/components/ruleImplementationForm/RuleImplementationRawForm.js +16 -6
  60. package/src/components/ruleImplementationForm/__tests__/LimitsForm.spec.js +186 -0
  61. package/src/components/ruleImplementationForm/__tests__/RuleImplementationRawForm.spec.js +42 -35
  62. package/src/components/ruleImplementationForm/__tests__/__snapshots__/LimitsForm.spec.js.snap +1104 -0
  63. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationForm.spec.js.snap +4 -1
  64. package/src/components/ruleImplementationForm/__tests__/__snapshots__/RuleImplementationRawForm.spec.js.snap +12 -1
  65. package/src/components/ruleImplementationForm/limitsValidation.js +72 -0
  66. package/src/messages/en.js +131 -71
  67. package/src/messages/es.js +254 -180
  68. package/src/reducers/__tests__/rule.spec.js +2 -4
  69. package/src/reducers/__tests__/ruleImplementation.spec.js +2 -0
  70. package/src/reducers/__tests__/ruleImplementations.spec.js +12 -8
  71. package/src/reducers/rule.js +0 -3
  72. package/src/reducers/ruleImplementation.js +3 -0
  73. package/src/reducers/ruleImplementations.js +3 -0
  74. package/src/selectors/getRuleImplementationColumns.js +38 -3
  75. package/src/selectors/ruleColumnsSelector.js +0 -31
  76. 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
+ });
@@ -11,7 +11,7 @@ describe("<NewRuleImplementation />", () => {
11
11
  ruleImplementationProps,
12
12
  createRuleImplementation,
13
13
  updateRuleImplementation,
14
- sources
14
+ sources,
15
15
  };
16
16
 
17
17
  it("matches the latest snapshot", () => {
@@ -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
 
@@ -6,6 +6,7 @@ const state = {
6
6
  authentication: { role: "admin" },
7
7
  rule: { id: 1, name: "foo" },
8
8
  ruleImplementation: {
9
+ rule_id: 1,
9
10
  implementation_key: "impl key",
10
11
  id: 1,
11
12
  },
@@ -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
  });
@@ -24,7 +24,7 @@ describe("<RuleImplementationsActions />", () => {
24
24
  addImplementationFilter,
25
25
  executeImplementationsOn: false,
26
26
  setMode,
27
- removeImplementationFilter
27
+ removeImplementationFilter,
28
28
  };
29
29
  it("matches the latest snapshot", () => {
30
30
  const wrapper = shallow(<RuleImplementationsActions {...props} />);
@@ -43,11 +43,11 @@ describe("<RuleImplementationsActions />", () => {
43
43
  executionGroupLoading: false,
44
44
  ruleImplementationCount: 12,
45
45
  implementationsExecution: true,
46
- role: "user"
46
+ role: "user",
47
47
  };
48
48
  const wrapper = shallow(<RuleImplementationsActions {...props} />);
49
49
  expect(wrapper.find({ id: "execute_checkbox" }).length).toBe(1);
50
- expect(wrapper.find("ConfirmModal").length).toBe(1);
50
+ expect(wrapper.find("Connect(ExecutionPopup)").length).toBe(1);
51
51
  });
52
52
 
53
53
  it("as user I do not see execute rules actions if I have no permission", () => {
@@ -55,11 +55,11 @@ describe("<RuleImplementationsActions />", () => {
55
55
  canExecute: false,
56
56
  executionGroupLoading: false,
57
57
  ruleImplementationCount: 12,
58
- implementationsExecution: true
58
+ implementationsExecution: true,
59
59
  };
60
60
  const wrapper = shallow(<RuleImplementationsActions {...props} />);
61
61
  expect(wrapper.find("Checkbox").length).toBe(0);
62
- expect(wrapper.find("ConfirmModal").length).toBe(0);
62
+ expect(wrapper.find("Connect(ExecutionPopup)").length).toBe(0);
63
63
  expect(wrapper.find({ id: "execute_button" }).length).toBe(0);
64
64
  });
65
65
 
@@ -69,12 +69,12 @@ describe("<RuleImplementationsActions />", () => {
69
69
  executionGroupLoading: false,
70
70
  ruleImplementationCount: 12,
71
71
  implementationsExecution: true,
72
- executeImplementationsOn: true
72
+ executeImplementationsOn: true,
73
73
  };
74
74
  const wrapper = shallow(<RuleImplementationsActions {...props} />);
75
75
  expect(wrapper.find("Checkbox").length).toBe(1);
76
76
  expect(wrapper.find("Checkbox").props().checked).toBeTruthy();
77
- expect(wrapper.find("ConfirmModal").length).toBe(1);
77
+ expect(wrapper.find("Connect(ExecutionPopup)").length).toBe(1);
78
78
  });
79
79
 
80
80
  it("handles checkbox onChange", () => {
@@ -85,11 +85,11 @@ describe("<RuleImplementationsActions />", () => {
85
85
  toCheck.simulate("change");
86
86
  expect(setMode).toHaveBeenCalledWith(true);
87
87
  expect(addImplementationFilter).toHaveBeenCalledWith({
88
- filter: "executable"
88
+ filter: "executable",
89
89
  });
90
90
  expect(toggleImplementationFilterValue).toHaveBeenCalledWith({
91
91
  filter: "executable",
92
- value: true
92
+ value: true,
93
93
  });
94
94
  wrapper.setProps({ executeImplementationsOn: true });
95
95
  setMode.mockReset();
@@ -98,29 +98,7 @@ describe("<RuleImplementationsActions />", () => {
98
98
  toUncheck.simulate("change");
99
99
  expect(setMode).toHaveBeenCalledWith(false);
100
100
  expect(removeImplementationFilter).toHaveBeenCalledWith({
101
- filter: "executable"
102
- });
103
- });
104
-
105
- it("as user I can submit an execution", () => {
106
- const createExecutionGroup = jest.fn();
107
- const props = {
108
- canExecute: true,
109
- executionGroupLoading: false,
110
- ruleImplementationCount: 12,
111
- implementationsExecution: true,
112
- executeImplementationsOn: true,
113
- createExecutionGroup,
114
- selectedImplementations: [],
115
- implementationQuery: { filters: { concept: ["foo"] } }
116
- };
117
- const wrapper = shallow(<RuleImplementationsActions {...props} />);
118
- _.find({ key: "yes" })(
119
- wrapper.find("ConfirmModal").props().actions
120
- ).onClick({ preventDefault() {} });
121
- expect(props.createExecutionGroup.mock.calls.length).toBe(1);
122
- expect(props.createExecutionGroup).toHaveBeenCalledWith({
123
- filters: { concept: ["foo"] }
101
+ filter: "executable",
124
102
  });
125
103
  });
126
104
  });
@@ -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
- goal: 10,
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();