@truedat/dq 4.48.3 → 4.48.6
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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.48.
|
|
3
|
+
"version": "4.48.6",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/core": "4.48.
|
|
92
|
-
"@truedat/df": "4.48.
|
|
91
|
+
"@truedat/core": "4.48.6",
|
|
92
|
+
"@truedat/df": "4.48.6",
|
|
93
93
|
"axios": "^0.19.2",
|
|
94
94
|
"graphql": "^15.5.3",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"react-dom": ">= 16.8.6 < 17",
|
|
111
111
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "06ed478bb99a0fb6ab5f5cc557808f8ee00d5e24"
|
|
114
114
|
}
|
|
@@ -148,10 +148,29 @@ export class RuleForm extends React.Component {
|
|
|
148
148
|
e.preventDefault();
|
|
149
149
|
if (this.messagesInformed(this.generateValidationMessages())) return;
|
|
150
150
|
const { onSubmit, match } = this.props;
|
|
151
|
-
|
|
151
|
+
|
|
152
|
+
const {
|
|
153
|
+
concept,
|
|
154
|
+
domain_id,
|
|
155
|
+
active,
|
|
156
|
+
description,
|
|
157
|
+
df_content,
|
|
158
|
+
df_name,
|
|
159
|
+
name,
|
|
160
|
+
} = this.state;
|
|
152
161
|
|
|
153
162
|
onSubmit({
|
|
154
|
-
rule
|
|
163
|
+
rule: {
|
|
164
|
+
...(concept?.business_concept_id && {
|
|
165
|
+
business_concept_id: concept?.business_concept_id,
|
|
166
|
+
}),
|
|
167
|
+
domain_id,
|
|
168
|
+
active,
|
|
169
|
+
description,
|
|
170
|
+
df_content,
|
|
171
|
+
df_name,
|
|
172
|
+
name,
|
|
173
|
+
},
|
|
155
174
|
ids: match.params,
|
|
156
175
|
});
|
|
157
176
|
};
|
|
@@ -204,7 +223,7 @@ export class RuleForm extends React.Component {
|
|
|
204
223
|
isSubmitting,
|
|
205
224
|
intl: { formatMessage },
|
|
206
225
|
} = this.props;
|
|
207
|
-
const {
|
|
226
|
+
const { valid, ...rule } = this.state;
|
|
208
227
|
const { domain_id } = rule;
|
|
209
228
|
const { concept, domainOptions } = this.props;
|
|
210
229
|
const messages = this.generateValidationMessages();
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export const globalState = {
|
|
2
|
+
ruleCreating: false,
|
|
3
|
+
ruleUpdating: false,
|
|
4
|
+
conceptRulesActions: {
|
|
5
|
+
domain_ids: [
|
|
6
|
+
{
|
|
7
|
+
external_id: "ARQUITECTURA",
|
|
8
|
+
id: 1,
|
|
9
|
+
name: "ARQ",
|
|
10
|
+
parent_id: null,
|
|
11
|
+
updated_at: "2020-04-01 11:30:42.177807Z",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
concept: {
|
|
16
|
+
id: 12157,
|
|
17
|
+
content: {
|
|
18
|
+
CHECKBOXES: "",
|
|
19
|
+
dependiente: "v4",
|
|
20
|
+
},
|
|
21
|
+
confidential: false,
|
|
22
|
+
description: {
|
|
23
|
+
document: {
|
|
24
|
+
data: {},
|
|
25
|
+
nodes: [
|
|
26
|
+
{
|
|
27
|
+
data: {},
|
|
28
|
+
nodes: [
|
|
29
|
+
{
|
|
30
|
+
marks: [],
|
|
31
|
+
object: "text",
|
|
32
|
+
text: "a",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
object: "block",
|
|
36
|
+
type: "paragraph",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
object: "document",
|
|
40
|
+
},
|
|
41
|
+
object: "value",
|
|
42
|
+
},
|
|
43
|
+
domain: {
|
|
44
|
+
id: 1,
|
|
45
|
+
name: "ARQ",
|
|
46
|
+
},
|
|
47
|
+
domain_parents: [
|
|
48
|
+
{
|
|
49
|
+
external_id: "ARQUITECTURA",
|
|
50
|
+
id: 1,
|
|
51
|
+
name: "ARQ",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
external_id: "Bankia Prueba",
|
|
55
|
+
id: 191,
|
|
56
|
+
name: "Bankia Prueba",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
name: "abc-def",
|
|
60
|
+
business_concept_id: 11960,
|
|
61
|
+
status: "published",
|
|
62
|
+
type: "test_checkboxes",
|
|
63
|
+
version: 1,
|
|
64
|
+
template: {
|
|
65
|
+
content: [
|
|
66
|
+
{
|
|
67
|
+
fields: [
|
|
68
|
+
{
|
|
69
|
+
cardinality: "?",
|
|
70
|
+
default: "",
|
|
71
|
+
label: "dependiente",
|
|
72
|
+
name: "dependiente",
|
|
73
|
+
type: "string",
|
|
74
|
+
values: {
|
|
75
|
+
fixed: ["v1", "v2", "v3", "v4"],
|
|
76
|
+
},
|
|
77
|
+
widget: "radio",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
cardinality: "*",
|
|
81
|
+
default: "",
|
|
82
|
+
label: "CHECKBOXES",
|
|
83
|
+
name: "CHECKBOXES",
|
|
84
|
+
type: "string",
|
|
85
|
+
values: {
|
|
86
|
+
switch: {
|
|
87
|
+
on: "dependiente",
|
|
88
|
+
values: {
|
|
89
|
+
v1: ["v11", "v22"],
|
|
90
|
+
v2: ["c2a", "c2b"],
|
|
91
|
+
v3: ["v3x", "v3y"],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
widget: "checkbox",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
name: "New Group 1",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
label: "test_checkboxes",
|
|
102
|
+
},
|
|
103
|
+
last_change_at: "2021-12-28T09:35:25.624552Z",
|
|
104
|
+
last_change_by: 29,
|
|
105
|
+
last_change_user: {
|
|
106
|
+
email: "user@domain.tld",
|
|
107
|
+
external_id: "",
|
|
108
|
+
full_name: "Full Name",
|
|
109
|
+
id: 29,
|
|
110
|
+
user_name: "user@domain.tld",
|
|
111
|
+
},
|
|
112
|
+
completeness: 50,
|
|
113
|
+
in_progress: false,
|
|
114
|
+
link_count: 0,
|
|
115
|
+
rule_count: 11,
|
|
116
|
+
concept_count: 4,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
@@ -4,6 +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 "../__test_samples__/RuleForm";
|
|
7
8
|
|
|
8
9
|
const rule = {
|
|
9
10
|
id: 123,
|
|
@@ -62,4 +63,41 @@ describe("<RuleForm />", () => {
|
|
|
62
63
|
expect(getByRole("button", { name: /save/i })).not.toBeDisabled();
|
|
63
64
|
});
|
|
64
65
|
});
|
|
66
|
+
|
|
67
|
+
it("submit rule data", async () => {
|
|
68
|
+
const onSubmit = jest.fn();
|
|
69
|
+
|
|
70
|
+
const renderOpts = {
|
|
71
|
+
mocks: [multipleTemplatesMock({ scope: "dq", domainIds: [1] })],
|
|
72
|
+
state: globalState,
|
|
73
|
+
fallback: "lazy",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const { getByRole } = render(<RuleForm onSubmit={onSubmit} />, renderOpts);
|
|
77
|
+
await waitFor(() =>
|
|
78
|
+
expect(getByRole("button", { name: /save/i })).toBeDisabled()
|
|
79
|
+
);
|
|
80
|
+
userEvent.click(getByRole("option", { name: "ARQ" }));
|
|
81
|
+
const ruleNameTextbox = getByRole("textbox", { name: /rule name/i });
|
|
82
|
+
userEvent.paste(ruleNameTextbox, "rule1");
|
|
83
|
+
expect(ruleNameTextbox).toHaveValue("rule1");
|
|
84
|
+
await waitFor(() => {
|
|
85
|
+
expect(getByRole("button", { name: /save/i })).not.toBeDisabled();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
userEvent.click(await getByRole("button", { name: /save/i }));
|
|
89
|
+
|
|
90
|
+
expect(onSubmit).toHaveBeenCalledWith({
|
|
91
|
+
ids: {},
|
|
92
|
+
rule: {
|
|
93
|
+
active: true,
|
|
94
|
+
business_concept_id: 11960,
|
|
95
|
+
description: {},
|
|
96
|
+
df_content: {},
|
|
97
|
+
df_name: undefined,
|
|
98
|
+
domain_id: 1,
|
|
99
|
+
name: "rule1",
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
});
|
|
65
103
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
4
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
@@ -23,7 +23,11 @@ const referenceDatasetsMock = {
|
|
|
23
23
|
};
|
|
24
24
|
const messages = { en };
|
|
25
25
|
|
|
26
|
-
const renderOpts = {
|
|
26
|
+
const renderOpts = {
|
|
27
|
+
mocks: [referenceDatasetsMock],
|
|
28
|
+
messages,
|
|
29
|
+
fallback: "lazy",
|
|
30
|
+
};
|
|
27
31
|
|
|
28
32
|
describe("<DatasetForm />", () => {
|
|
29
33
|
const setStructures = jest.fn();
|
|
@@ -31,7 +35,7 @@ describe("<DatasetForm />", () => {
|
|
|
31
35
|
const selector = -1;
|
|
32
36
|
const setImplementationKey = jest.fn();
|
|
33
37
|
const implementationKey = "Impl";
|
|
34
|
-
const structures = [1, 2];
|
|
38
|
+
const structures = [{ id: 1 }, { id: 2 }];
|
|
35
39
|
|
|
36
40
|
const props = {
|
|
37
41
|
implementationKey,
|
|
@@ -44,9 +48,7 @@ describe("<DatasetForm />", () => {
|
|
|
44
48
|
|
|
45
49
|
it("matches the latest snapshot", async () => {
|
|
46
50
|
const { container, queryByText } = render(
|
|
47
|
-
<
|
|
48
|
-
<DatasetForm {...props} />
|
|
49
|
-
</Suspense>,
|
|
51
|
+
<DatasetForm {...props} />,
|
|
50
52
|
renderOpts
|
|
51
53
|
);
|
|
52
54
|
|