@truedat/qx 8.12.2 → 8.12.5
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 +3 -3
- package/src/components/common/expressions/FunctionSelector.js +2 -2
- package/src/components/common/expressions/__tests__/Condition.spec.js +2 -0
- package/src/components/common/expressions/__tests__/Expression.spec.js +2 -0
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +2 -0
- package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +81 -69
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +27 -23
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +162 -138
- package/src/components/dataViews/__tests__/SimpleDataViewEditor.spec.js +15 -0
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +2 -0
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +2 -0
- package/src/components/functions/__tests__/__snapshots__/FunctionEditor.spec.js.snap +81 -69
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +7 -1
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +19 -15
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +8 -3
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +2 -0
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +16 -117
- package/src/components/qualityControls/__tests__/QualityControlEvents.spec.js +18 -4
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +8 -11
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +5 -2
- package/src/components/selectors/__tests__/getQualityControlScoresColumns.spec.js +15 -0
- package/src/components/selectors/getQualityControlScoresColumns.js +1 -1
|
@@ -363,41 +363,45 @@ exports[`<FunctionEditor /> matches snapshot without onDelete 1`] = `
|
|
|
363
363
|
style="pointer-events: all;"
|
|
364
364
|
>
|
|
365
365
|
<div
|
|
366
|
-
class="
|
|
366
|
+
class="text"
|
|
367
367
|
>
|
|
368
368
|
<div
|
|
369
|
-
class="
|
|
369
|
+
class="ui header"
|
|
370
370
|
>
|
|
371
|
-
<div>
|
|
372
|
-
eq
|
|
373
|
-
</div>
|
|
374
371
|
<div
|
|
375
|
-
class="
|
|
372
|
+
class="flex-center"
|
|
376
373
|
>
|
|
377
|
-
<div
|
|
378
|
-
|
|
379
|
-
>
|
|
380
|
-
<i
|
|
381
|
-
aria-hidden="true"
|
|
382
|
-
class="question circle outline icon"
|
|
383
|
-
/>
|
|
384
|
-
arg1
|
|
374
|
+
<div>
|
|
375
|
+
eq
|
|
385
376
|
</div>
|
|
386
377
|
<div
|
|
387
|
-
class="
|
|
378
|
+
class="function-params-label"
|
|
388
379
|
>
|
|
389
|
-
<
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
380
|
+
<div
|
|
381
|
+
class="ui grey label"
|
|
382
|
+
>
|
|
383
|
+
<i
|
|
384
|
+
aria-hidden="true"
|
|
385
|
+
class="question circle outline icon"
|
|
386
|
+
/>
|
|
387
|
+
arg1
|
|
388
|
+
</div>
|
|
389
|
+
<div
|
|
390
|
+
class="ui grey label"
|
|
391
|
+
>
|
|
392
|
+
<i
|
|
393
|
+
aria-hidden="true"
|
|
394
|
+
class="question circle outline icon"
|
|
395
|
+
/>
|
|
396
|
+
arg2
|
|
397
|
+
</div>
|
|
394
398
|
</div>
|
|
395
399
|
</div>
|
|
396
400
|
</div>
|
|
401
|
+
<div
|
|
402
|
+
class="sub header"
|
|
403
|
+
/>
|
|
397
404
|
</div>
|
|
398
|
-
<div
|
|
399
|
-
class="sub header"
|
|
400
|
-
/>
|
|
401
405
|
</div>
|
|
402
406
|
</div>
|
|
403
407
|
</div>
|
|
@@ -798,41 +802,45 @@ exports[`<FunctionEditor /> matches the latest snapshot 1`] = `
|
|
|
798
802
|
style="pointer-events: all;"
|
|
799
803
|
>
|
|
800
804
|
<div
|
|
801
|
-
class="
|
|
805
|
+
class="text"
|
|
802
806
|
>
|
|
803
807
|
<div
|
|
804
|
-
class="
|
|
808
|
+
class="ui header"
|
|
805
809
|
>
|
|
806
|
-
<div>
|
|
807
|
-
eq
|
|
808
|
-
</div>
|
|
809
810
|
<div
|
|
810
|
-
class="
|
|
811
|
+
class="flex-center"
|
|
811
812
|
>
|
|
812
|
-
<div
|
|
813
|
-
|
|
814
|
-
>
|
|
815
|
-
<i
|
|
816
|
-
aria-hidden="true"
|
|
817
|
-
class="question circle outline icon"
|
|
818
|
-
/>
|
|
819
|
-
arg1
|
|
813
|
+
<div>
|
|
814
|
+
eq
|
|
820
815
|
</div>
|
|
821
816
|
<div
|
|
822
|
-
class="
|
|
817
|
+
class="function-params-label"
|
|
823
818
|
>
|
|
824
|
-
<
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
819
|
+
<div
|
|
820
|
+
class="ui grey label"
|
|
821
|
+
>
|
|
822
|
+
<i
|
|
823
|
+
aria-hidden="true"
|
|
824
|
+
class="question circle outline icon"
|
|
825
|
+
/>
|
|
826
|
+
arg1
|
|
827
|
+
</div>
|
|
828
|
+
<div
|
|
829
|
+
class="ui grey label"
|
|
830
|
+
>
|
|
831
|
+
<i
|
|
832
|
+
aria-hidden="true"
|
|
833
|
+
class="question circle outline icon"
|
|
834
|
+
/>
|
|
835
|
+
arg2
|
|
836
|
+
</div>
|
|
829
837
|
</div>
|
|
830
838
|
</div>
|
|
831
839
|
</div>
|
|
840
|
+
<div
|
|
841
|
+
class="sub header"
|
|
842
|
+
/>
|
|
832
843
|
</div>
|
|
833
|
-
<div
|
|
834
|
-
class="sub header"
|
|
835
|
-
/>
|
|
836
844
|
</div>
|
|
837
845
|
</div>
|
|
838
846
|
</div>
|
|
@@ -1627,41 +1635,45 @@ exports[`<FunctionEditor /> test delete button 1`] = `
|
|
|
1627
1635
|
style="pointer-events: all;"
|
|
1628
1636
|
>
|
|
1629
1637
|
<div
|
|
1630
|
-
class="
|
|
1638
|
+
class="text"
|
|
1631
1639
|
>
|
|
1632
1640
|
<div
|
|
1633
|
-
class="
|
|
1641
|
+
class="ui header"
|
|
1634
1642
|
>
|
|
1635
|
-
<div>
|
|
1636
|
-
eq
|
|
1637
|
-
</div>
|
|
1638
1643
|
<div
|
|
1639
|
-
class="
|
|
1644
|
+
class="flex-center"
|
|
1640
1645
|
>
|
|
1641
|
-
<div
|
|
1642
|
-
|
|
1643
|
-
>
|
|
1644
|
-
<i
|
|
1645
|
-
aria-hidden="true"
|
|
1646
|
-
class="question circle outline icon"
|
|
1647
|
-
/>
|
|
1648
|
-
arg1
|
|
1646
|
+
<div>
|
|
1647
|
+
eq
|
|
1649
1648
|
</div>
|
|
1650
1649
|
<div
|
|
1651
|
-
class="
|
|
1650
|
+
class="function-params-label"
|
|
1652
1651
|
>
|
|
1653
|
-
<
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1652
|
+
<div
|
|
1653
|
+
class="ui grey label"
|
|
1654
|
+
>
|
|
1655
|
+
<i
|
|
1656
|
+
aria-hidden="true"
|
|
1657
|
+
class="question circle outline icon"
|
|
1658
|
+
/>
|
|
1659
|
+
arg1
|
|
1660
|
+
</div>
|
|
1661
|
+
<div
|
|
1662
|
+
class="ui grey label"
|
|
1663
|
+
>
|
|
1664
|
+
<i
|
|
1665
|
+
aria-hidden="true"
|
|
1666
|
+
class="question circle outline icon"
|
|
1667
|
+
/>
|
|
1668
|
+
arg2
|
|
1669
|
+
</div>
|
|
1658
1670
|
</div>
|
|
1659
1671
|
</div>
|
|
1660
1672
|
</div>
|
|
1673
|
+
<div
|
|
1674
|
+
class="sub header"
|
|
1675
|
+
/>
|
|
1661
1676
|
</div>
|
|
1662
|
-
<div
|
|
1663
|
-
class="sub header"
|
|
1664
|
-
/>
|
|
1665
1677
|
</div>
|
|
1666
1678
|
</div>
|
|
1667
1679
|
</div>
|
|
@@ -6,6 +6,10 @@ import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
|
6
6
|
import { linkTo } from "@truedat/core/routes";
|
|
7
7
|
import { SOURCE_OPTIONS_QUERY } from "@truedat/cx/sources/api/queries";
|
|
8
8
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
9
|
+
// Load the editor's lazy modules before Jest starts timing the first test.
|
|
10
|
+
import "@truedat/df/components/SelectableDynamicForm";
|
|
11
|
+
import "@truedat/df/components/DynamicFormViewer";
|
|
12
|
+
import "@truedat/cx/sources/components/SourceSelector";
|
|
9
13
|
import {
|
|
10
14
|
useQualityControlUpdateDraft,
|
|
11
15
|
useQualityControl,
|
|
@@ -17,6 +21,8 @@ import {
|
|
|
17
21
|
qualityControlData,
|
|
18
22
|
} from "./__fixtures__/qualityControlHelper";
|
|
19
23
|
|
|
24
|
+
beforeEach(() => jest.useRealTimers());
|
|
25
|
+
|
|
20
26
|
const mockNavigate = jest.fn();
|
|
21
27
|
|
|
22
28
|
jest.mock("react-router", () => ({
|
|
@@ -122,7 +128,7 @@ const renderOpts = {
|
|
|
122
128
|
describe("<EditQualityControl />", () => {
|
|
123
129
|
it("matches the latest snapshot", async () => {
|
|
124
130
|
const rendered = render(<EditQualityControl />, renderOpts);
|
|
125
|
-
await waitForLoad(rendered);
|
|
131
|
+
await waitForLoad(rendered, /loading/i, { timeout: 5000 });
|
|
126
132
|
// Wait for async state updates from GraphQL queries to complete
|
|
127
133
|
await waitFor(() => {
|
|
128
134
|
expect(rendered.getByPlaceholderText(/name/i)).toBeInTheDocument();
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
-
import {
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
4
|
import { singleTemplateMock, templateByNameMock } from "@truedat/test/mocks";
|
|
5
5
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
6
6
|
import { QUALITY_CONTROLS, linkTo } from "@truedat/core/routes";
|
|
7
7
|
import { SOURCE_OPTIONS_QUERY } from "@truedat/cx/sources/api/queries";
|
|
8
8
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
9
|
+
// Load the editor's lazy modules before Jest starts timing the first test.
|
|
10
|
+
import "@truedat/df/components/SelectableDynamicForm";
|
|
11
|
+
import "@truedat/df/components/DynamicFormViewer";
|
|
12
|
+
import "@truedat/cx/sources/components/SourceSelector";
|
|
9
13
|
import { useQualityControlCreate } from "@truedat/qx/hooks/useQualityControls";
|
|
10
14
|
import NewQualityControl from "../NewQualityControl";
|
|
11
15
|
import { sources, domains } from "./__fixtures__/qualityControlHelper";
|
|
@@ -107,13 +111,19 @@ const renderOpts = {
|
|
|
107
111
|
};
|
|
108
112
|
|
|
109
113
|
describe("<NewQualityControl />", () => {
|
|
114
|
+
beforeEach(() => jest.useRealTimers());
|
|
115
|
+
|
|
110
116
|
it("matches the latest snapshot", async () => {
|
|
111
117
|
const rendered = render(<NewQualityControl />, renderOpts);
|
|
112
|
-
await waitForLoad(rendered);
|
|
118
|
+
await waitForLoad(rendered, /loading/i, { timeout: 5000 });
|
|
113
119
|
// Wait for async state updates from GraphQL queries to complete
|
|
114
120
|
await waitFor(() => {
|
|
115
121
|
expect(rendered.getByPlaceholderText(/name/i)).toBeInTheDocument();
|
|
116
122
|
});
|
|
123
|
+
await rendered.findByPlaceholderText("field1", undefined, {
|
|
124
|
+
timeout: 5000,
|
|
125
|
+
});
|
|
126
|
+
await waitForLoad(rendered, /loading/i, { timeout: 5000 });
|
|
117
127
|
expect(rendered.container).toMatchSnapshot();
|
|
118
128
|
});
|
|
119
129
|
|
|
@@ -206,14 +216,10 @@ describe("<NewQualityControl />", () => {
|
|
|
206
216
|
await user.click(rendered.getByText(/reference_dataset/i));
|
|
207
217
|
await user.click(rendered.getByRole("option", { name: /dataset1/i }));
|
|
208
218
|
|
|
209
|
-
await
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
);
|
|
214
|
-
await user.click(rendered.getByRole("option", { name: "eq" }));
|
|
215
|
-
await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
|
|
216
|
-
});
|
|
219
|
+
await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
|
|
220
|
+
await user.click(rendered.getByText("expression.condition.selectFunction"));
|
|
221
|
+
await user.click(rendered.getByRole("option", { name: "eq" }));
|
|
222
|
+
await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
|
|
217
223
|
|
|
218
224
|
// Navigate to step 2 (Segmentation)
|
|
219
225
|
await user.click(rendered.getByRole("button", { name: /forward/i }));
|
|
@@ -415,11 +421,9 @@ describe("<NewQualityControl />", () => {
|
|
|
415
421
|
rendered.getAllByRole("option", { name: /campo1/ }).length,
|
|
416
422
|
).toBeGreaterThan(0),
|
|
417
423
|
);
|
|
418
|
-
await
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
|
|
422
|
-
});
|
|
424
|
+
await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
|
|
425
|
+
await user.click(rendered.getByRole("option", { name: "eq" }));
|
|
426
|
+
await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
|
|
423
427
|
|
|
424
428
|
// Navigate to step 2 (Segmentation)
|
|
425
429
|
await user.click(rendered.getByRole("button", { name: /forward/i }));
|
|
@@ -4,6 +4,8 @@ import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
import { templateByNameMock } from "@truedat/test/mocks";
|
|
6
6
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
7
|
+
// Load the summary's lazy module before Jest starts timing the first test.
|
|
8
|
+
import "@truedat/df/components/DynamicFormViewer";
|
|
7
9
|
import QualityControl from "../QualityControl";
|
|
8
10
|
import { qualityControlData } from "./__fixtures__/qualityControlHelper";
|
|
9
11
|
|
|
@@ -42,6 +44,8 @@ const renderOpts = {
|
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
describe("<QualityControl />", () => {
|
|
47
|
+
beforeEach(() => jest.useRealTimers());
|
|
48
|
+
|
|
45
49
|
it("matches the latest snapshot", async () => {
|
|
46
50
|
const context = {
|
|
47
51
|
qualityControl: qualityControlData(),
|
|
@@ -53,7 +57,7 @@ describe("<QualityControl />", () => {
|
|
|
53
57
|
</TestFormWrapper>,
|
|
54
58
|
renderOpts,
|
|
55
59
|
);
|
|
56
|
-
await waitForLoad(rendered);
|
|
60
|
+
await waitForLoad(rendered, /loading/i, { timeout: 5000 });
|
|
57
61
|
expect(rendered.container).toMatchSnapshot();
|
|
58
62
|
});
|
|
59
63
|
|
|
@@ -72,6 +76,7 @@ describe("<QualityControl />", () => {
|
|
|
72
76
|
});
|
|
73
77
|
|
|
74
78
|
it("render popup when edit domain", async () => {
|
|
79
|
+
const user = userEvent.setup({ delay: null });
|
|
75
80
|
const context = {
|
|
76
81
|
qualityControl: qualityControlData(),
|
|
77
82
|
actions: ["update_main", "update_domain"],
|
|
@@ -87,12 +92,12 @@ describe("<QualityControl />", () => {
|
|
|
87
92
|
const pencilButton = rendered.container.querySelector(
|
|
88
93
|
".pencil.alternate.icon",
|
|
89
94
|
);
|
|
90
|
-
|
|
95
|
+
await user.click(pencilButton);
|
|
91
96
|
|
|
92
97
|
await waitFor(() => {
|
|
93
98
|
expect(rendered.queryByText(/foodomain/i)).toBeInTheDocument();
|
|
94
99
|
});
|
|
95
|
-
|
|
100
|
+
await user.click(pencilButton);
|
|
96
101
|
await waitFor(() => {
|
|
97
102
|
expect(rendered.queryByText(/foodomain/i)).not.toBeInTheDocument();
|
|
98
103
|
});
|
|
@@ -79,6 +79,8 @@ const renderOpts = {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
describe("<QualityControlActions />", () => {
|
|
82
|
+
beforeEach(() => jest.useRealTimers());
|
|
83
|
+
|
|
82
84
|
it("matches the latest snapshot with actions for published status", async () => {
|
|
83
85
|
const rendered = render(
|
|
84
86
|
<TestFormWrapper context={{ ...context }}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { waitFor, fireEvent } from "@testing-library/react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
3
|
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
4
|
import { DOMAINS_QUERY } from "@truedat/core/api/queries";
|
|
@@ -6,6 +6,11 @@ import { singleTemplateMock, templateByNameMock } from "@truedat/test/mocks";
|
|
|
6
6
|
import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
|
|
7
7
|
import { SOURCE_OPTIONS_QUERY } from "@truedat/cx/sources/api/queries";
|
|
8
8
|
import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
9
|
+
// Evaluate the editor's lazy modules before the first test starts. Jest's
|
|
10
|
+
// coverage transform can otherwise consume the waitForLoad timeout in CI.
|
|
11
|
+
import "@truedat/df/components/SelectableDynamicForm";
|
|
12
|
+
import "@truedat/df/components/DynamicFormViewer";
|
|
13
|
+
import "@truedat/cx/sources/components/SourceSelector";
|
|
9
14
|
import { defaultQualityControl } from "../NewQualityControl";
|
|
10
15
|
import QualityControlEditor from "../QualityControlEditor";
|
|
11
16
|
import {
|
|
@@ -109,9 +114,11 @@ const props = {
|
|
|
109
114
|
};
|
|
110
115
|
|
|
111
116
|
describe("<QualityControlEditor />", () => {
|
|
117
|
+
beforeEach(() => jest.useRealTimers());
|
|
118
|
+
|
|
112
119
|
it("matches the latest snapshot for edition", async () => {
|
|
113
120
|
const rendered = render(<QualityControlEditor {...props} />, renderOpts);
|
|
114
|
-
await waitForLoad(rendered);
|
|
121
|
+
await waitForLoad(rendered, /loading/i, { timeout: 5000 });
|
|
115
122
|
// Wait for async state updates from GraphQL queries to complete
|
|
116
123
|
await waitFor(() => {
|
|
117
124
|
expect(rendered.getByPlaceholderText(/name/i)).toBeInTheDocument();
|
|
@@ -280,133 +287,25 @@ describe("<QualityControlEditor />", () => {
|
|
|
280
287
|
);
|
|
281
288
|
});
|
|
282
289
|
|
|
283
|
-
it("
|
|
290
|
+
it("allows toggling active when creating a quality control", async () => {
|
|
284
291
|
const user = userEvent.setup({ delay: null });
|
|
285
|
-
const newProps = {
|
|
286
|
-
...props,
|
|
287
|
-
value: undefined,
|
|
288
|
-
};
|
|
289
292
|
const rendered = render(
|
|
290
293
|
<QualityControlEditor
|
|
291
|
-
{...
|
|
294
|
+
{...props}
|
|
292
295
|
value={defaultQualityControl}
|
|
293
296
|
isModification={false}
|
|
294
297
|
/>,
|
|
295
298
|
renderOpts,
|
|
296
299
|
);
|
|
297
300
|
await waitForLoad(rendered);
|
|
298
|
-
// Wait for async state updates from GraphQL queries to complete
|
|
299
|
-
await waitFor(() => {
|
|
300
|
-
expect(rendered.getByPlaceholderText(/name/i)).toBeInTheDocument();
|
|
301
|
-
});
|
|
302
301
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
expect(
|
|
306
|
-
rendered.queryByRole("button", { name: /publish/i }),
|
|
307
|
-
).not.toBeInTheDocument();
|
|
308
|
-
expect(
|
|
309
|
-
rendered.queryByRole("button", { name: /save/i }),
|
|
310
|
-
).not.toBeInTheDocument();
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
// Fill step 0 (Information)
|
|
314
|
-
await user.click(rendered.getByText(/enable/i));
|
|
315
|
-
await user.type(rendered.getByPlaceholderText(/name/i), "test_modified");
|
|
316
|
-
|
|
317
|
-
await user.type(
|
|
318
|
-
rendered.getByPlaceholderText(/field1/i),
|
|
319
|
-
"field_template_modified",
|
|
320
|
-
);
|
|
321
|
-
// Wait for SelectableDynamicForm to finish updating state (prevents act() warning)
|
|
322
|
-
await waitFor(
|
|
323
|
-
() => {
|
|
324
|
-
const input = rendered.getByPlaceholderText(/field1/i);
|
|
325
|
-
expect(input).toHaveValue("field_template_modified");
|
|
326
|
-
},
|
|
327
|
-
{ timeout: 2000 },
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
await user.click(rendered.getByText(/select domains/i));
|
|
331
|
-
await user.click(rendered.getByText(/bardomain/i));
|
|
332
|
-
|
|
333
|
-
await user.click(
|
|
334
|
-
rendered.getByRole("option", {
|
|
335
|
-
name: /quality_control.control_mode.error_count/i,
|
|
336
|
-
}),
|
|
302
|
+
const activeInput = rendered.container.querySelector(
|
|
303
|
+
'input[name="active"]',
|
|
337
304
|
);
|
|
305
|
+
expect(activeInput).toBeChecked();
|
|
338
306
|
|
|
339
|
-
await user.
|
|
340
|
-
|
|
341
|
-
/quality_control.score_criteria.error_count.goal/i,
|
|
342
|
-
),
|
|
343
|
-
"25",
|
|
344
|
-
);
|
|
345
|
-
await user.type(
|
|
346
|
-
rendered.getByPlaceholderText(
|
|
347
|
-
/quality_control.score_criteria.error_count.maximum/i,
|
|
348
|
-
),
|
|
349
|
-
"50",
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
// Navigate to step 1 (Control Properties)
|
|
353
|
-
await user.click(rendered.getByRole("button", { name: /forward/i }));
|
|
354
|
-
await waitFor(() =>
|
|
355
|
-
expect(
|
|
356
|
-
rendered.getByRole("button", { name: /back/i }),
|
|
357
|
-
).toBeInTheDocument(),
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
// Fill step 1 - Source selector is now in step 1
|
|
361
|
-
await user.click(rendered.getByText(/select source/i));
|
|
362
|
-
await user.click(
|
|
363
|
-
rendered.getByRole("option", { name: /external_source_id/i }),
|
|
364
|
-
);
|
|
365
|
-
|
|
366
|
-
await user.click(rendered.getByText(/resource type/i));
|
|
367
|
-
await user.click(rendered.getByText(/reference datasets/i));
|
|
368
|
-
await user.click(rendered.getByRole("option", { name: /dataset1/i }));
|
|
369
|
-
|
|
370
|
-
await waitFor(() =>
|
|
371
|
-
expect(
|
|
372
|
-
rendered.getAllByRole("option", { name: /campo1/ }).length,
|
|
373
|
-
).toBeGreaterThan(0),
|
|
374
|
-
);
|
|
375
|
-
|
|
376
|
-
await act(async () => {
|
|
377
|
-
await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
|
|
378
|
-
});
|
|
379
|
-
await waitFor(() =>
|
|
380
|
-
expect(rendered.getByText(/select function/i)).toBeInTheDocument(),
|
|
381
|
-
);
|
|
382
|
-
await act(async () => {
|
|
383
|
-
await user.click(rendered.getByText(/select function/i));
|
|
384
|
-
await user.click(rendered.getByText(/eq/i));
|
|
385
|
-
await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
await waitFor(() =>
|
|
389
|
-
expect(rendered.getByRole("button", { name: /forward/i })).toBeEnabled(),
|
|
390
|
-
);
|
|
391
|
-
|
|
392
|
-
// Navigate to step 2 (Segmentation)
|
|
393
|
-
await user.click(rendered.getByRole("button", { name: /forward/i }));
|
|
394
|
-
|
|
395
|
-
await waitFor(() =>
|
|
396
|
-
expect(
|
|
397
|
-
rendered.queryByRole("button", { name: /forward/i }),
|
|
398
|
-
).not.toBeInTheDocument(),
|
|
399
|
-
);
|
|
400
|
-
|
|
401
|
-
await waitFor(() =>
|
|
402
|
-
expect(
|
|
403
|
-
rendered.getByRole("button", { name: /publish/i }),
|
|
404
|
-
).toBeInTheDocument(),
|
|
405
|
-
);
|
|
406
|
-
|
|
407
|
-
await waitFor(() =>
|
|
408
|
-
expect(rendered.getByRole("button", { name: /publish/i })).toBeEnabled(),
|
|
409
|
-
);
|
|
307
|
+
await user.click(rendered.getByText(/enable/i));
|
|
308
|
+
expect(activeInput).not.toBeChecked();
|
|
410
309
|
});
|
|
411
310
|
|
|
412
311
|
it("test fill form for edition", async () => {
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { messages as baseMessages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
|
|
4
4
|
import { useEvents } from "@truedat/audit/hooks/useEvents";
|
|
5
|
+
import { TEMPLATE_QUERY } from "@truedat/core/api/queries";
|
|
5
6
|
import QxContext from "../../QxContext";
|
|
6
7
|
import QualityControlEvents from "../QualityControlEvents";
|
|
7
8
|
|
|
@@ -28,7 +29,20 @@ const messages = {
|
|
|
28
29
|
},
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
const renderOpts = {
|
|
32
|
+
const renderOpts = {
|
|
33
|
+
messages,
|
|
34
|
+
mocks: [
|
|
35
|
+
{
|
|
36
|
+
request: {
|
|
37
|
+
query: TEMPLATE_QUERY,
|
|
38
|
+
variables: { name: "template1", domainIds: [2] },
|
|
39
|
+
},
|
|
40
|
+
result: { data: { template: null } },
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const qualityControl = { id: "qc-1", df_type: "template1", domain_ids: [2] };
|
|
32
46
|
|
|
33
47
|
afterEach(() => {
|
|
34
48
|
jest.clearAllMocks();
|
|
@@ -52,7 +66,7 @@ describe("<QualityControlEvents />", () => {
|
|
|
52
66
|
});
|
|
53
67
|
|
|
54
68
|
const contextValue = {
|
|
55
|
-
qualityControl
|
|
69
|
+
qualityControl,
|
|
56
70
|
loading: false,
|
|
57
71
|
};
|
|
58
72
|
|
|
@@ -80,7 +94,7 @@ describe("<QualityControlEvents />", () => {
|
|
|
80
94
|
});
|
|
81
95
|
|
|
82
96
|
const contextValue = {
|
|
83
|
-
qualityControl
|
|
97
|
+
qualityControl,
|
|
84
98
|
loading: false,
|
|
85
99
|
};
|
|
86
100
|
|
|
@@ -102,7 +116,7 @@ describe("<QualityControlEvents />", () => {
|
|
|
102
116
|
});
|
|
103
117
|
|
|
104
118
|
const contextValue = {
|
|
105
|
-
qualityControl
|
|
119
|
+
qualityControl,
|
|
106
120
|
loading: true,
|
|
107
121
|
};
|
|
108
122
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import userEvent from "@testing-library/user-event";
|
|
2
2
|
import { within } from "@testing-library/dom";
|
|
3
3
|
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
|
-
import { act } from "@testing-library/react";
|
|
5
4
|
import { singleTemplateMock } from "@truedat/test/mocks";
|
|
6
5
|
import SearchContext from "@truedat/core/search/SearchContext";
|
|
7
6
|
import { useScoreGroupCreate } from "@truedat/qx/hooks/useScoreGroups";
|
|
@@ -39,6 +38,8 @@ const searchProps = {
|
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
describe("<QualityControls />", () => {
|
|
41
|
+
beforeEach(() => jest.useRealTimers());
|
|
42
|
+
|
|
42
43
|
it("matches the latest snapshot", async () => {
|
|
43
44
|
const rendered = render(
|
|
44
45
|
<SearchContext value={searchProps}>
|
|
@@ -133,11 +134,9 @@ describe("<QualityControls />", () => {
|
|
|
133
134
|
rendered.getByRole("button", { name: /actions.do_execution/i }),
|
|
134
135
|
).toBeEnabled();
|
|
135
136
|
|
|
136
|
-
await
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
);
|
|
140
|
-
});
|
|
137
|
+
await user.click(
|
|
138
|
+
rendered.getByRole("button", { name: /actions.do_execution/i }),
|
|
139
|
+
);
|
|
141
140
|
|
|
142
141
|
await waitForLoad(rendered);
|
|
143
142
|
|
|
@@ -188,11 +187,9 @@ describe("<QualityControls />", () => {
|
|
|
188
187
|
rendered.container.querySelector("#row-checkbox-1").parentElement,
|
|
189
188
|
).toHaveClass("checked");
|
|
190
189
|
|
|
191
|
-
await
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
);
|
|
195
|
-
});
|
|
190
|
+
await user.click(
|
|
191
|
+
rendered.getByRole("button", { name: /actions.do_execution/i }),
|
|
192
|
+
);
|
|
196
193
|
|
|
197
194
|
await waitForLoad(rendered);
|
|
198
195
|
|
|
@@ -11,6 +11,8 @@ const renderOpts = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
describe("<ScoreGroupPopup />", () => {
|
|
14
|
+
beforeEach(() => jest.useRealTimers());
|
|
15
|
+
|
|
14
16
|
const onSubmit = jest.fn();
|
|
15
17
|
const props = { count: 1, onSubmit, loading: false };
|
|
16
18
|
|
|
@@ -41,16 +43,17 @@ describe("<ScoreGroupPopup />", () => {
|
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
it("should display execution form on button click", async () => {
|
|
46
|
+
const user = userEvent.setup();
|
|
44
47
|
const onSubmit = jest.fn();
|
|
45
48
|
const props = { count: 1, onSubmit, loading: false };
|
|
46
49
|
const { getByRole } = render(<ScoreGroupPopup {...props} />, renderOpts);
|
|
47
|
-
|
|
50
|
+
await user.click(getByRole("button"));
|
|
48
51
|
|
|
49
52
|
await waitFor(() => {
|
|
50
53
|
expect(getByRole("button", { name: /Create/i })).toBeEnabled();
|
|
51
54
|
});
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
await user.click(getByRole("button", { name: /Create/i }));
|
|
54
57
|
|
|
55
58
|
await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));
|
|
56
59
|
});
|