@truedat/dq 4.48.6 → 4.48.9
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 +12 -0
- package/package.json +9 -4
- package/src/components/__tests__/NewRuleImplementation.spec.js +132 -125
- package/src/components/__tests__/RuleForm.spec.js +1 -1
- package/src/components/{__test_samples__ → __tests__/__fixtures__}/NewRuleImplementationProps.js +301 -332
- package/src/components/{__test_samples__ → __tests__/__fixtures__}/RuleForm.js +0 -0
- package/src/components/{__test_samples__ → __tests__/__fixtures__}/newRuleImplementationHelper.js +188 -429
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +12 -12
- package/src/selectors/getRuleImplementationColumns.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.48.9] 2022-07-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-4922] add status column for implementations table
|
|
8
|
+
|
|
9
|
+
## [4.48.7]
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- [TD-5029] Reenable submit test commented out in [TD-4661]
|
|
14
|
+
|
|
3
15
|
## [4.48.6] 2022-07-15
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.48.
|
|
3
|
+
"version": "4.48.9",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -71,6 +71,11 @@
|
|
|
71
71
|
"enzyme-to-json/serializer"
|
|
72
72
|
],
|
|
73
73
|
"testEnvironment": "jsdom",
|
|
74
|
+
"testMatch": [
|
|
75
|
+
"**/__tests__/**/*.[jt]s?(x)",
|
|
76
|
+
"**/?(*.)+(spec|test).[jt]s?(x)",
|
|
77
|
+
"!**/__fixtures__/**"
|
|
78
|
+
],
|
|
74
79
|
"testPathIgnorePatterns": [
|
|
75
80
|
"<rootDir>/node_modules/"
|
|
76
81
|
],
|
|
@@ -88,8 +93,8 @@
|
|
|
88
93
|
},
|
|
89
94
|
"dependencies": {
|
|
90
95
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/core": "4.48.
|
|
92
|
-
"@truedat/df": "4.48.
|
|
96
|
+
"@truedat/core": "4.48.9",
|
|
97
|
+
"@truedat/df": "4.48.9",
|
|
93
98
|
"axios": "^0.19.2",
|
|
94
99
|
"graphql": "^15.5.3",
|
|
95
100
|
"path-to-regexp": "^1.7.0",
|
|
@@ -110,5 +115,5 @@
|
|
|
110
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
111
116
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
112
117
|
},
|
|
113
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "82d6ab8fb0b3000bf4b8975670d3e5cf15b14487"
|
|
114
119
|
}
|
|
@@ -8,11 +8,11 @@ import defaultMessages from "@truedat/test/messages";
|
|
|
8
8
|
import NewRuleImplementation, {
|
|
9
9
|
NewRuleImplementation as NewRuleImplementationComponent,
|
|
10
10
|
} from "../NewRuleImplementation";
|
|
11
|
-
import { newRuleImplementationProps } from "
|
|
11
|
+
import { newRuleImplementationProps } from "./__fixtures__/NewRuleImplementationProps";
|
|
12
12
|
import {
|
|
13
13
|
ruleImplementationLoaderGlobalState,
|
|
14
14
|
ruleImplementationLoaderActions,
|
|
15
|
-
} from "
|
|
15
|
+
} from "./__fixtures__/newRuleImplementationHelper";
|
|
16
16
|
|
|
17
17
|
describe("<NewRuleImplementation />", () => {
|
|
18
18
|
const createRuleImplementation = jest.fn();
|
|
@@ -130,7 +130,7 @@ describe("<NewRuleImplementation> NewRuleImplementation doSubmit", () => {
|
|
|
130
130
|
id: 11127109,
|
|
131
131
|
parent_index: 4,
|
|
132
132
|
name: "EMAIL",
|
|
133
|
-
type: "
|
|
133
|
+
type: "column",
|
|
134
134
|
},
|
|
135
135
|
value: [],
|
|
136
136
|
value_modifier: [],
|
|
@@ -207,126 +207,133 @@ describe("<NewRuleImplementation> NewRuleImplementation doSubmit", () => {
|
|
|
207
207
|
});
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
210
|
+
it("doSubmit: unique across fields operator", async () => {
|
|
211
|
+
const expectedRuleImplementation = {
|
|
212
|
+
...expectedRuleImplementationBase,
|
|
213
|
+
validations: [
|
|
214
|
+
{
|
|
215
|
+
modifier: null,
|
|
216
|
+
operator: { name: "unique", value_type: "field_list" },
|
|
217
|
+
population: [],
|
|
218
|
+
structure: {
|
|
219
|
+
id: 11127109,
|
|
220
|
+
parent_index: 4,
|
|
221
|
+
name: "EMAIL",
|
|
222
|
+
type: "column",
|
|
223
|
+
},
|
|
224
|
+
value: [
|
|
225
|
+
{
|
|
226
|
+
fields: [
|
|
227
|
+
{
|
|
228
|
+
id: 11127109,
|
|
229
|
+
name: "EMAIL",
|
|
230
|
+
parent_index: 4,
|
|
231
|
+
path: undefined,
|
|
232
|
+
type: "column",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: 11127116,
|
|
236
|
+
name: "PHONE_NUMBER",
|
|
237
|
+
parent_index: 4,
|
|
238
|
+
path: undefined,
|
|
239
|
+
type: "column",
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
value_modifier: [],
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const { queryByText, getByRole, findByRole, findByTestId } = render(
|
|
250
|
+
<NewRuleImplementation {...props} />,
|
|
251
|
+
renderOptsImplementationEdit
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
// Information Form
|
|
255
|
+
|
|
256
|
+
await waitFor(() => {
|
|
257
|
+
expect(queryByText(/Template/)).toBeTruthy();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
userEvent.click(await findByRole("option", { name: "template1" }));
|
|
261
|
+
|
|
262
|
+
await waitFor(() => {
|
|
263
|
+
expect(getByRole("button", { name: "Next" })).toBeEnabled();
|
|
264
|
+
});
|
|
265
|
+
userEvent.click(await getByRole("button", { name: "Next" }));
|
|
266
|
+
|
|
267
|
+
// Dataset Form
|
|
268
|
+
|
|
269
|
+
await waitFor(() => {
|
|
270
|
+
expect(getByRole("button", { name: "Next" })).toBeEnabled();
|
|
271
|
+
});
|
|
272
|
+
userEvent.click(await getByRole("button", { name: "Next" }));
|
|
273
|
+
|
|
274
|
+
// Population Form
|
|
275
|
+
|
|
276
|
+
await waitFor(() => {
|
|
277
|
+
expect(getByRole("button", { name: "Next" })).toBeEnabled();
|
|
278
|
+
});
|
|
279
|
+
userEvent.click(await getByRole("button", { name: "Next" }));
|
|
280
|
+
|
|
281
|
+
// Validations Form
|
|
282
|
+
|
|
283
|
+
userEvent.click(await findByRole("button", { name: "add-condition-row" }));
|
|
284
|
+
|
|
285
|
+
const row = await findByTestId("row-0");
|
|
286
|
+
|
|
287
|
+
const field = row.querySelector('div[label="Field"]');
|
|
288
|
+
const operator = row.querySelector('div[label="Operator"]');
|
|
289
|
+
|
|
290
|
+
userEvent.click(field);
|
|
291
|
+
const fieldOptions = await within(field).findByRole("listbox");
|
|
292
|
+
const emailFieldOption = within(fieldOptions).getByText("EMAIL");
|
|
293
|
+
userEvent.click(emailFieldOption);
|
|
294
|
+
const selectedField = fieldOptions.querySelector(".selected>span");
|
|
295
|
+
expect(within(selectedField).queryByText(/EMAIL/)).toBeInTheDocument();
|
|
296
|
+
|
|
297
|
+
userEvent.click(operator);
|
|
298
|
+
const operatorOptions = await within(operator).findByRole("listbox");
|
|
299
|
+
const uniqueAcrossFieldsOperatorOption = within(operatorOptions).getByText(
|
|
300
|
+
"unique across fields"
|
|
301
|
+
);
|
|
302
|
+
userEvent.click(uniqueAcrossFieldsOperatorOption);
|
|
303
|
+
const selectedOperator = operatorOptions.querySelector(".selected>span");
|
|
304
|
+
expect(
|
|
305
|
+
within(selectedOperator).queryByText(/unique across fields/)
|
|
306
|
+
).toBeInTheDocument();
|
|
307
|
+
|
|
308
|
+
const updatedRow = await findByTestId("row-0");
|
|
309
|
+
const value = updatedRow.querySelector('div[label="Value"]');
|
|
310
|
+
userEvent.click(value);
|
|
311
|
+
const valueOptions = await within(value).findByRole("listbox");
|
|
312
|
+
const valueEmailFieldOption = within(valueOptions).getByText("EMAIL");
|
|
313
|
+
const valuePhoneNumberFieldOption =
|
|
314
|
+
within(valueOptions).getByText("PHONE_NUMBER");
|
|
315
|
+
|
|
316
|
+
userEvent.click(valueEmailFieldOption);
|
|
317
|
+
userEvent.click(valuePhoneNumberFieldOption);
|
|
318
|
+
|
|
319
|
+
const selectedFieldValues = updatedRow.querySelectorAll(".label");
|
|
320
|
+
|
|
321
|
+
const selectedFieldTexts = [...selectedFieldValues].map(
|
|
322
|
+
(selectedFieldValue) => selectedFieldValue.text
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
expect(_.difference(selectedFieldTexts, ["EMAIL", "PHONE_NUMBER"])).toEqual(
|
|
326
|
+
[]
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
await waitFor(() => {
|
|
330
|
+
expect(getByRole("button", { name: "Save" })).toBeEnabled();
|
|
331
|
+
});
|
|
332
|
+
userEvent.click(await getByRole("button", { name: "Save" }));
|
|
333
|
+
|
|
334
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
335
|
+
...ruleImplementationLoaderActions.updateRuleImplementation(),
|
|
336
|
+
payload: { rule_implementation: expectedRuleImplementation },
|
|
337
|
+
});
|
|
338
|
+
});
|
|
332
339
|
});
|
|
@@ -4,7 +4,7 @@ import { render } from "@truedat/test/render";
|
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
import { multipleTemplatesMock } from "@truedat/test/mocks";
|
|
6
6
|
import RuleForm from "../RuleForm";
|
|
7
|
-
import { globalState } from "
|
|
7
|
+
import { globalState } from "./__fixtures__/RuleForm";
|
|
8
8
|
|
|
9
9
|
const rule = {
|
|
10
10
|
id: 123,
|