@truedat/qx 8.12.2 → 8.12.4

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 (22) hide show
  1. package/package.json +3 -3
  2. package/src/components/common/expressions/FunctionSelector.js +2 -2
  3. package/src/components/common/expressions/__tests__/Condition.spec.js +2 -0
  4. package/src/components/common/expressions/__tests__/Expression.spec.js +2 -0
  5. package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +2 -0
  6. package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +81 -69
  7. package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +27 -23
  8. package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +162 -138
  9. package/src/components/dataViews/__tests__/SimpleDataViewEditor.spec.js +15 -0
  10. package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +2 -0
  11. package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +2 -0
  12. package/src/components/functions/__tests__/__snapshots__/FunctionEditor.spec.js.snap +81 -69
  13. package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +7 -1
  14. package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +19 -15
  15. package/src/components/qualityControls/__tests__/QualityControl.spec.js +8 -3
  16. package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +2 -0
  17. package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +13 -10
  18. package/src/components/qualityControls/__tests__/QualityControlEvents.spec.js +18 -4
  19. package/src/components/qualityControls/__tests__/QualityControls.spec.js +8 -11
  20. package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +5 -2
  21. package/src/components/selectors/__tests__/getQualityControlScoresColumns.spec.js +15 -0
  22. 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="ui header"
366
+ class="text"
367
367
  >
368
368
  <div
369
- class="flex-center"
369
+ class="ui header"
370
370
  >
371
- <div>
372
- eq
373
- </div>
374
371
  <div
375
- class="function-params-label"
372
+ class="flex-center"
376
373
  >
377
- <div
378
- class="ui grey label"
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="ui grey label"
378
+ class="function-params-label"
388
379
  >
389
- <i
390
- aria-hidden="true"
391
- class="question circle outline icon"
392
- />
393
- arg2
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="ui header"
805
+ class="text"
802
806
  >
803
807
  <div
804
- class="flex-center"
808
+ class="ui header"
805
809
  >
806
- <div>
807
- eq
808
- </div>
809
810
  <div
810
- class="function-params-label"
811
+ class="flex-center"
811
812
  >
812
- <div
813
- class="ui grey label"
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="ui grey label"
817
+ class="function-params-label"
823
818
  >
824
- <i
825
- aria-hidden="true"
826
- class="question circle outline icon"
827
- />
828
- arg2
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="ui header"
1638
+ class="text"
1631
1639
  >
1632
1640
  <div
1633
- class="flex-center"
1641
+ class="ui header"
1634
1642
  >
1635
- <div>
1636
- eq
1637
- </div>
1638
1643
  <div
1639
- class="function-params-label"
1644
+ class="flex-center"
1640
1645
  >
1641
- <div
1642
- class="ui grey label"
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="ui grey label"
1650
+ class="function-params-label"
1652
1651
  >
1653
- <i
1654
- aria-hidden="true"
1655
- class="question circle outline icon"
1656
- />
1657
- arg2
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 { act, waitFor } from "@testing-library/react";
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 act(async () => {
210
- await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
211
- await user.click(
212
- rendered.getByText("expression.condition.selectFunction"),
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 act(async () => {
419
- await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
420
- await user.click(rendered.getByRole("option", { name: "eq" }));
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
- userEvent.click(pencilButton);
95
+ await user.click(pencilButton);
91
96
 
92
97
  await waitFor(() => {
93
98
  expect(rendered.queryByText(/foodomain/i)).toBeInTheDocument();
94
99
  });
95
- userEvent.click(pencilButton);
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 { act, waitFor, fireEvent } from "@testing-library/react";
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();
@@ -373,17 +380,13 @@ describe("<QualityControlEditor />", () => {
373
380
  ).toBeGreaterThan(0),
374
381
  );
375
382
 
376
- await act(async () => {
377
- await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
378
- });
383
+ await user.click(rendered.getAllByRole("option", { name: /campo1/ })[0]);
379
384
  await waitFor(() =>
380
385
  expect(rendered.getByText(/select function/i)).toBeInTheDocument(),
381
386
  );
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
+ await user.click(rendered.getByText(/select function/i));
388
+ await user.click(rendered.getByText(/eq/i));
389
+ await user.click(rendered.getAllByRole("option", { name: /campo2/ })[1]);
387
390
 
388
391
  await waitFor(() =>
389
392
  expect(rendered.getByRole("button", { name: /forward/i })).toBeEnabled(),
@@ -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 = { messages };
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: { id: "qc-1" },
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: { id: "qc-1" },
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: { id: "qc-1" },
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 act(async () => {
137
- await user.click(
138
- rendered.getByRole("button", { name: /actions.do_execution/i }),
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 act(async () => {
192
- await user.click(
193
- rendered.getByRole("button", { name: /actions.do_execution/i }),
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
- userEvent.click(getByRole("button"));
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
- userEvent.click(getByRole("button", { name: /Create/i }));
56
+ await user.click(getByRole("button", { name: /Create/i }));
54
57
 
55
58
  await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));
56
59
  });
@@ -1,6 +1,8 @@
1
1
  import _ from "lodash/fp";
2
+ import { isValidElement } from "react";
2
3
  import { render } from "@truedat/test/render";
3
4
  import { scoreData } from "@truedat/qx/components/scores/__tests__/__fixtures__/scoreHelper";
5
+ import QualityBadge from "@truedat/qx/components/qualityControls/QualityBadge";
4
6
  import { defaultQualityControlScoresColumns } from "../getQualityControlScoresColumns";
5
7
  import { getQualityControlScoresColumns } from "../getQualityControlScoresColumns";
6
8
 
@@ -40,4 +42,17 @@ describe("selectors: getQualityControlScoresColumns", () => {
40
42
 
41
43
  expect(rendered.container).toHaveTextContent("score.status.PENDING");
42
44
  });
45
+
46
+ it("renders the quality badge as a component", () => {
47
+ const score = scoreData();
48
+ const qualityColumn = defaultQualityControlScoresColumns.find(
49
+ ({ name }) => name === "quality",
50
+ );
51
+
52
+ const badge = qualityColumn.fieldDecorator({ score });
53
+
54
+ expect(isValidElement(badge)).toBe(true);
55
+ expect(badge.type).toBe(QualityBadge);
56
+ expect(badge.props.score).toBe(score);
57
+ });
43
58
  });
@@ -40,7 +40,7 @@ export const defaultQualityControlScoresColumns = [
40
40
  {
41
41
  name: "quality",
42
42
  fieldSelector: (score) => ({ score }),
43
- fieldDecorator: QualityBadge,
43
+ fieldDecorator: ({ score }) => <QualityBadge score={score} />,
44
44
  },
45
45
  {
46
46
  name: "control_mode",