@truedat/dq 6.12.6 → 6.13.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "6.12.6",
3
+ "version": "6.13.1",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -92,8 +92,8 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@apollo/client": "^3.7.1",
95
- "@truedat/core": "6.12.6",
96
- "@truedat/df": "6.12.6",
95
+ "@truedat/core": "6.13.1",
96
+ "@truedat/df": "6.13.1",
97
97
  "decode-uri-component": "^0.2.2",
98
98
  "graphql": "^15.5.3",
99
99
  "moment": "^2.29.4",
@@ -118,5 +118,5 @@
118
118
  "react-dom": ">= 16.8.6 < 17",
119
119
  "semantic-ui-react": ">= 2.0.3 < 2.2"
120
120
  },
121
- "gitHead": "6ee7f5e8767d2149347997223377f91f0164ee34"
121
+ "gitHead": "3803d8c4a416f1e1f56d88989c6c7503a08467d8"
122
122
  }
@@ -19,6 +19,7 @@ ConceptRuleForm.propTypes = {
19
19
 
20
20
  export const NewRule = ({ createRule, concept }) => {
21
21
  const { business_concept_id } = useParams();
22
+
22
23
  return (
23
24
  <Container as={Segment} text>
24
25
  <Header as="h2">
@@ -48,12 +48,15 @@ export const calculateResultDecoration = ({
48
48
  _.prop("results"),
49
49
  (results) => _.isArray(results) && !_.isEmpty(results)
50
50
  );
51
+ const hasRequiredFields = (ruleImplementation) =>
52
+ _.has("goal")(ruleImplementation) && _.has("minimum")(ruleImplementation);
51
53
  const firstResult = _.flow(_.prop("results"), _.first);
52
54
  const defaultValue = { goal: null, minimum: null };
53
55
 
54
56
  const { goal, minimum } = _.cond([
55
57
  [executionInfoIsObject, _.prop("execution_result_info")],
56
58
  [notEmptyResults, firstResult],
59
+ [hasRequiredFields, _.pick(["goal", "minimum"])],
57
60
  [_.stubTrue, () => defaultValue],
58
61
  ])(ruleImplementation);
59
62
 
@@ -3,6 +3,11 @@ import { waitFor } from "@testing-library/react";
3
3
  import { render } from "@truedat/test/render";
4
4
  import NewRule from "../NewRule";
5
5
 
6
+ jest.mock("react-router-dom", () => ({
7
+ ...jest.requireActual("react-router-dom"),
8
+ useParams: () => ({ business_concept_id: 123 }),
9
+ }));
10
+
6
11
  const state = {
7
12
  concept: { business_concept_id: 123, domain_id: 22 },
8
13
  conceptActiveFilters: {},
@@ -11,9 +16,10 @@ const renderOpts = { fallback: "lazy", state };
11
16
 
12
17
  describe("<NewRule />", () => {
13
18
  it("matches the latest snapshot (with concept)", async () => {
14
- // falla el snapshot porque viene sin description y falta algún campo
15
- const { container, findByText } = render(<NewRule />, renderOpts);
16
- await findByText(/No results found./);
17
- expect(container).toMatchSnapshot();
19
+ const { container, getByText } = render(<NewRule />, renderOpts);
20
+ await waitFor(() => {
21
+ expect(getByText(/Template/i)).toBeInTheDocument();
22
+ expect(container).toMatchSnapshot();
23
+ });
18
24
  });
19
25
  });
@@ -219,6 +219,60 @@ exports[`<NewRule /> matches the latest snapshot (with concept) 1`] = `
219
219
  </div>
220
220
  </label>
221
221
  </div>
222
+ <div
223
+ class="required field"
224
+ >
225
+ <label>
226
+ Template
227
+ <div
228
+ class="ui left pointing label"
229
+ >
230
+ Empty required field
231
+ </div>
232
+ </label>
233
+ <div
234
+ class="field"
235
+ >
236
+ <div
237
+ aria-busy="true"
238
+ aria-expanded="false"
239
+ class="ui loading search selection dropdown"
240
+ name="template"
241
+ role="combobox"
242
+ >
243
+ <input
244
+ aria-autocomplete="list"
245
+ autocomplete="off"
246
+ class="search"
247
+ tabindex="0"
248
+ type="text"
249
+ value=""
250
+ />
251
+ <div
252
+ aria-atomic="true"
253
+ aria-live="polite"
254
+ class="divider default text"
255
+ role="alert"
256
+ >
257
+ loading...
258
+ </div>
259
+ <i
260
+ aria-hidden="true"
261
+ class="dropdown icon"
262
+ />
263
+ <div
264
+ class="menu transition"
265
+ role="listbox"
266
+ >
267
+ <div
268
+ class="message"
269
+ >
270
+ No results found.
271
+ </div>
272
+ </div>
273
+ </div>
274
+ </div>
275
+ </div>
222
276
  <div
223
277
  class="actions"
224
278
  >