@truedat/qx 7.5.9 → 7.5.10

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 (229) hide show
  1. package/package.json +45 -64
  2. package/src/components/QxRoutes.js +38 -19
  3. package/src/components/__tests__/QxRoutes.spec.js +73 -0
  4. package/src/components/__tests__/__snapshots__/QxRoutes.spec.js.snap +60 -0
  5. package/src/components/common/ClauseViewer.js +6 -6
  6. package/src/components/common/DescriptionInput.js +0 -1
  7. package/src/components/common/ResourceSelector.js +2 -3
  8. package/src/components/common/TestFormWrapper.js +2 -13
  9. package/src/components/common/TypeSelector.js +0 -1
  10. package/src/components/common/__tests__/DescriptionInput.spec.js +12 -21
  11. package/src/components/common/__tests__/ResourceSelector.spec.js +42 -87
  12. package/src/components/common/__tests__/TypeSelector.spec.js +0 -1
  13. package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +32 -22
  14. package/src/components/common/expressions/Clauses.js +5 -6
  15. package/src/components/common/expressions/Condition.js +8 -9
  16. package/src/components/common/expressions/ConstantSelector.js +2 -2
  17. package/src/components/common/expressions/Expression.js +2 -2
  18. package/src/components/common/expressions/FieldSelector.js +2 -2
  19. package/src/components/common/expressions/FunctionArgs.js +5 -6
  20. package/src/components/common/expressions/FunctionSelector.js +2 -2
  21. package/src/components/common/expressions/ParamSelector.js +2 -2
  22. package/src/components/common/expressions/ShapeSelector.js +7 -16
  23. package/src/components/common/expressions/__tests__/Clauses.spec.js +10 -9
  24. package/src/components/common/expressions/__tests__/Condition.spec.js +6 -26
  25. package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +14 -30
  26. package/src/components/common/expressions/__tests__/Expression.spec.js +44 -51
  27. package/src/components/common/expressions/__tests__/FieldSelector.spec.js +2 -7
  28. package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +18 -44
  29. package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +19 -27
  30. package/src/components/common/expressions/__tests__/ParamSelector.spec.js +28 -58
  31. package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +42 -43
  32. package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +6 -6
  33. package/src/components/common/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap +6 -7
  34. package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +20 -20
  35. package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +8 -9
  36. package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +670 -8
  37. package/src/components/common/expressions/__tests__/__snapshots__/ParamSelector.spec.js.snap +5 -5
  38. package/src/components/common/expressions/__tests__/__snapshots__/ShapeSelector.spec.js.snap +9 -9
  39. package/src/components/common/expressions/__tests__/useWatchParams.spec.js +1 -4
  40. package/src/components/common/expressions/constantInputs/AnySelector.js +5 -6
  41. package/src/components/common/expressions/constantInputs/BooleanSelector.js +2 -2
  42. package/src/components/common/expressions/constantInputs/DefaultSelector.js +2 -2
  43. package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +16 -37
  44. package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +14 -17
  45. package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +12 -27
  46. package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/AnySelector.spec.js.snap +11 -11
  47. package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/DefaultSelector.spec.js.snap +0 -1
  48. package/src/components/common/resourceSelectors/DataStructureSelector.js +2 -2
  49. package/src/components/common/resourceSelectors/DataViewSelector.js +2 -2
  50. package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +2 -2
  51. package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +5 -29
  52. package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +23 -25
  53. package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +21 -32
  54. package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +3 -4
  55. package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataViewSelector.spec.js.snap +1 -1
  56. package/src/components/common/resourceSelectors/__tests__/__snapshots__/ReferenceDatasetSelector.spec.js.snap +1 -1
  57. package/src/components/dataViews/DataViewEditor.js +5 -6
  58. package/src/components/dataViews/DataViewSelect.js +4 -5
  59. package/src/components/dataViews/DataViews.js +1 -2
  60. package/src/components/dataViews/Queryable.js +4 -4
  61. package/src/components/dataViews/Queryables.js +0 -1
  62. package/src/components/dataViews/__tests__/DataViewEditor.spec.js +36 -111
  63. package/src/components/dataViews/__tests__/DataViewSelect.spec.js +0 -1
  64. package/src/components/dataViews/__tests__/DataViews.spec.js +15 -16
  65. package/src/components/dataViews/__tests__/Queryable.spec.js +0 -1
  66. package/src/components/dataViews/__tests__/Queryables.spec.js +35 -74
  67. package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +61 -55
  68. package/src/components/dataViews/__tests__/__snapshots__/DataViews.spec.js.snap +5 -5
  69. package/src/components/dataViews/__tests__/__snapshots__/Queryables.spec.js.snap +59 -59
  70. package/src/components/dataViews/queryableProperties/From.js +4 -4
  71. package/src/components/dataViews/queryableProperties/GroupBy.js +6 -6
  72. package/src/components/dataViews/queryableProperties/Join.js +6 -6
  73. package/src/components/dataViews/queryableProperties/JoinTypeIcon.js +8 -9
  74. package/src/components/dataViews/queryableProperties/Select.js +4 -5
  75. package/src/components/dataViews/queryableProperties/SelectField.js +4 -4
  76. package/src/components/dataViews/queryableProperties/Where.js +4 -4
  77. package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +0 -1
  78. package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +16 -42
  79. package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +6 -29
  80. package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +0 -1
  81. package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +26 -50
  82. package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +22 -42
  83. package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +6 -17
  84. package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +309 -9
  85. package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Join.spec.js.snap +12 -12
  86. package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Select.spec.js.snap +192 -18
  87. package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/SelectField.spec.js.snap +6 -8
  88. package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Where.spec.js.snap +2 -2
  89. package/src/components/functions/FunctionEditor.js +3 -5
  90. package/src/components/functions/FunctionParams.js +2 -3
  91. package/src/components/functions/Functions.js +3 -4
  92. package/src/components/functions/__tests__/FunctionEditor.spec.js +61 -57
  93. package/src/components/functions/__tests__/FunctionParams.spec.js +50 -47
  94. package/src/components/functions/__tests__/Functions.spec.js +5 -12
  95. package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +11 -11
  96. package/src/components/functions/__tests__/__snapshots__/Functions.spec.js.snap +4 -5
  97. package/src/components/qualityControls/ControlProperties.js +4 -4
  98. package/src/components/qualityControls/ControlPropertiesView.js +0 -1
  99. package/src/components/qualityControls/EditQualityControl.js +5 -5
  100. package/src/components/qualityControls/IconPopup.js +0 -1
  101. package/src/components/qualityControls/NewDraftQualityControl.js +8 -6
  102. package/src/components/qualityControls/NewQualityControl.js +5 -6
  103. package/src/components/qualityControls/QualityBadge.js +29 -30
  104. package/src/components/qualityControls/QualityControl.js +4 -7
  105. package/src/components/qualityControls/QualityControlActions.js +7 -7
  106. package/src/components/qualityControls/QualityControlCrumbs.js +1 -3
  107. package/src/components/qualityControls/QualityControlEditor.js +5 -11
  108. package/src/components/qualityControls/QualityControlHeader.js +4 -6
  109. package/src/components/qualityControls/QualityControlHistory.js +3 -3
  110. package/src/components/qualityControls/QualityControlManageDomain.js +2 -2
  111. package/src/components/qualityControls/QualityControlQueryModal.js +1 -1
  112. package/src/components/qualityControls/QualityControlRoutes.js +27 -54
  113. package/src/components/qualityControls/QualityControlRow.js +0 -2
  114. package/src/components/qualityControls/QualityControlScores.js +7 -5
  115. package/src/components/qualityControls/QualityControlTabs.js +2 -2
  116. package/src/components/qualityControls/QualityControls.js +10 -8
  117. package/src/components/qualityControls/QualityControlsLabelResults.js +0 -2
  118. package/src/components/qualityControls/QualityControlsPagination.js +0 -1
  119. package/src/components/qualityControls/QualityControlsTable.js +1 -2
  120. package/src/components/qualityControls/ScoreCriteria.js +4 -4
  121. package/src/components/qualityControls/ScoreCriteriaView.js +0 -1
  122. package/src/components/qualityControls/__tests__/ControlProperties.spec.js +10 -15
  123. package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +0 -1
  124. package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +28 -70
  125. package/src/components/qualityControls/__tests__/IconPopup.spec.js +10 -11
  126. package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +33 -70
  127. package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +81 -113
  128. package/src/components/qualityControls/__tests__/QualityBadge.spec.js +50 -58
  129. package/src/components/qualityControls/__tests__/QualityControl.spec.js +19 -31
  130. package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +49 -46
  131. package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +0 -1
  132. package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +68 -107
  133. package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +22 -25
  134. package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +6 -6
  135. package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +0 -1
  136. package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +12 -11
  137. package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -8
  138. package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +23 -19
  139. package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +2 -3
  140. package/src/components/qualityControls/__tests__/QualityControls.spec.js +69 -53
  141. package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +0 -1
  142. package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +0 -1
  143. package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +2 -3
  144. package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +0 -1
  145. package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +0 -1
  146. package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +1 -1
  147. package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +32 -34
  148. package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +31 -33
  149. package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +17 -19
  150. package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +9 -15
  151. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +5 -4
  152. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlCrumbs.spec.js.snap +1 -0
  153. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +0 -3
  154. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +16 -11
  155. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +2 -0
  156. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +2 -1
  157. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +3 -0
  158. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +3 -0
  159. package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +11 -21
  160. package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +2 -0
  161. package/src/components/qualityControls/controlProperties/Count.js +5 -5
  162. package/src/components/qualityControls/controlProperties/Ratio.js +6 -8
  163. package/src/components/qualityControls/controlProperties/__tests__/Count.spec.js +6 -11
  164. package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +9 -27
  165. package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +10 -10
  166. package/src/components/qualityControls/qualityByControlMode.js +14 -14
  167. package/src/components/qualityControls/qualityControlScoresColumns.js +1 -2
  168. package/src/components/qualityControls/scoreCriterias/Deviation.js +2 -2
  169. package/src/components/qualityControls/scoreCriterias/ErrorCount.js +3 -4
  170. package/src/components/qualityControls/scoreCriterias/Percentage.js +2 -2
  171. package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +0 -1
  172. package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +39 -43
  173. package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +23 -19
  174. package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/ErrorCount.spec.js.snap +4 -7
  175. package/src/components/scores/MyScoreGroups.js +0 -1
  176. package/src/components/scores/QualityBar.js +24 -22
  177. package/src/components/scores/Score.js +4 -5
  178. package/src/components/scores/ScoreCrumbs.js +3 -5
  179. package/src/components/scores/ScoreDetails.js +2 -2
  180. package/src/components/scores/ScoreEvents.js +2 -2
  181. package/src/components/scores/ScoreGroup.js +5 -4
  182. package/src/components/scores/ScoreGroupBreadcrumbs.js +1 -2
  183. package/src/components/scores/ScoreGroupForm.js +2 -4
  184. package/src/components/scores/ScoreGroupLink.js +1 -2
  185. package/src/components/scores/ScoreGroupMessage.js +0 -1
  186. package/src/components/scores/ScoreGroupPopup.js +1 -1
  187. package/src/components/scores/ScoreGroupsRoutes.js +19 -0
  188. package/src/components/scores/ScoreGroupsTable.js +15 -48
  189. package/src/components/scores/ScoreRoutes.js +9 -24
  190. package/src/components/scores/ScoreStatusDecorator.js +1 -2
  191. package/src/components/scores/ScoreTabs.js +2 -2
  192. package/src/components/scores/__tests__/MyScoreGroups.spec.js +0 -1
  193. package/src/components/scores/__tests__/QualityBar.spec.js +19 -26
  194. package/src/components/scores/__tests__/Score.spec.js +2 -3
  195. package/src/components/scores/__tests__/ScoreCrumbs.spec.js +4 -5
  196. package/src/components/scores/__tests__/ScoreDetails.spec.js +4 -5
  197. package/src/components/scores/__tests__/ScoreEvents.spec.js +2 -3
  198. package/src/components/scores/__tests__/ScoreGroup.spec.js +15 -14
  199. package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +0 -1
  200. package/src/components/scores/__tests__/ScoreGroupForm.spec.js +18 -34
  201. package/src/components/scores/__tests__/ScoreGroupLink.spec.js +0 -1
  202. package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +0 -1
  203. package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +0 -2
  204. package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +32 -0
  205. package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +0 -1
  206. package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +0 -1
  207. package/src/components/scores/__tests__/ScoreTabs.spec.js +3 -4
  208. package/src/components/scores/__tests__/__snapshots__/MyScoreGroups.spec.js.snap +2 -0
  209. package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +4 -0
  210. package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +2 -0
  211. package/src/components/scores/__tests__/__snapshots__/ScoreDetails.spec.js.snap +1 -0
  212. package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +39 -10
  213. package/src/components/scores/__tests__/__snapshots__/ScoreGroupBreadcrumbs.spec.js.snap +1 -0
  214. package/src/components/scores/__tests__/__snapshots__/ScoreGroupForm.spec.js.snap +10 -10
  215. package/src/components/scores/__tests__/__snapshots__/ScoreGroupLink.spec.js.snap +1 -0
  216. package/src/components/scores/__tests__/__snapshots__/ScoreGroupsRoutes.spec.js.snap +19 -0
  217. package/src/components/scores/__tests__/__snapshots__/ScoreGroupsTable.spec.js.snap +2 -0
  218. package/src/components/scores/__tests__/__snapshots__/ScoreStatusDecorator.spec.js.snap +5 -0
  219. package/src/components/scores/__tests__/__snapshots__/ScoreTabs.spec.js.snap +4 -0
  220. package/src/hooks/__tests__/useDataViews.spec.js +1 -1
  221. package/src/hooks/__tests__/useFunctions.spec.js +5 -5
  222. package/src/hooks/useDataViews.js +2 -2
  223. package/src/hooks/useExecutionGroups.js +1 -1
  224. package/src/hooks/useFunctions.js +4 -4
  225. package/src/hooks/useQualityControls.js +13 -7
  226. package/src/hooks/useScoreGroups.js +1 -1
  227. package/src/hooks/useScores.js +2 -2
  228. package/src/styles/scores.less +21 -21
  229. package/src/types.js +1 -4
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
4
3
  import Clauses from "../Clauses";
5
4
 
@@ -11,21 +10,22 @@ const renderOpts = {
11
10
  "expression.clause.action.addExpression": "addExpression",
12
11
  },
13
12
  },
14
- fallback: "lazy",
15
13
  };
16
14
 
17
15
  describe("<Clauses />", () => {
18
- it("matches the latest snapshot", () => {
19
- const { container } = render(
16
+ it("matches the latest snapshot", async () => {
17
+ const rendered = render(
20
18
  <TestFormWrapper>
21
19
  <Clauses />
22
20
  </TestFormWrapper>,
23
21
  renderOpts
24
22
  );
25
- expect(container).toMatchSnapshot();
23
+ await waitForLoad(rendered);
24
+ expect(rendered.container).toMatchSnapshot();
26
25
  });
27
- it("matches the latest snapshot with content", () => {
28
- const { container } = render(
26
+
27
+ it("matches the latest snapshot with content", async () => {
28
+ const rendered = render(
29
29
  <TestFormWrapper
30
30
  context={{
31
31
  field: "test",
@@ -48,6 +48,7 @@ describe("<Clauses />", () => {
48
48
  </TestFormWrapper>,
49
49
  renderOpts
50
50
  );
51
- expect(container).toMatchSnapshot();
51
+ await waitForLoad(rendered);
52
+ expect(rendered.container).toMatchSnapshot();
52
53
  });
53
54
  });
@@ -1,36 +1,16 @@
1
- import React from "react";
2
- import { act } from "react-dom/test-utils";
3
- import { render } from "@truedat/test/render";
4
- import { waitFor } from "@testing-library/react";
1
+ import { render, waitForLoad } from "@truedat/test/render";
5
2
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
6
3
  import Condition from "../Condition";
7
4
 
8
- const renderOpts = {
9
- messages: {
10
- en: {
11
- "functions.form.required": "Required",
12
- "expression.condition.selectFunction": "Select Function",
13
- "expression.condition.customExpression": "Custom Expression",
14
- "functions.form.expression.function.placeholder": "function placeholder",
15
- "functions.expression.shape.function": "Function",
16
- "functions.expression.shape.constant": "Constant",
17
- },
18
- },
19
- };
20
-
21
5
  describe("<Condition />", () => {
22
6
  it("matches the latest snapshot", async () => {
23
- const { container } = render(
7
+ const rendered = render(
24
8
  <TestFormWrapper>
25
9
  <Condition />
26
- </TestFormWrapper>,
27
- renderOpts
28
- );
29
- await waitFor(() =>
30
- expect(container.querySelector(".loader")).not.toBeInTheDocument()
10
+ </TestFormWrapper>
31
11
  );
32
- await act(async () => {
33
- expect(container).toMatchSnapshot();
34
- });
12
+ await waitForLoad(rendered);
13
+
14
+ expect(rendered.container).toMatchSnapshot();
35
15
  });
36
16
  });
@@ -1,48 +1,32 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
3
1
  import userEvent from "@testing-library/user-event";
2
+ import { render, waitForLoad } from "@truedat/test/render";
4
3
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
5
4
  import ConstantSelector from "../ConstantSelector";
6
5
 
7
- const renderOpts = {
8
- messages: {
9
- en: {
10
- "functions.expression.constant.false": "false",
11
- "functions.expression.constant.true": "true",
12
- "functions.form.required": "required",
13
- "expressions.data_type.timestamp": "timestamp",
14
- "expressions.data_type.date": "date",
15
- "expressions.data_type.number": "number",
16
- "expressions.data_type.string": "string",
17
- "expressions.data_type.boolean": "boolean",
18
- },
19
- },
20
- fallback: "lazy",
21
- };
22
-
23
6
  describe("<ConstantSelector />", () => {
24
- it("matches the latest snapshot", () => {
25
- const { container } = render(
7
+ it("matches the latest snapshot", async () => {
8
+ const rendered = render(
26
9
  <TestFormWrapper>
27
10
  <ConstantSelector />
28
- </TestFormWrapper>,
29
- renderOpts
11
+ </TestFormWrapper>
30
12
  );
31
- expect(container).toMatchSnapshot();
13
+ await waitForLoad(rendered);
14
+ expect(rendered.container).toMatchSnapshot();
32
15
  });
33
16
 
34
17
  it("user interaction", async () => {
18
+ const user = userEvent.setup({ delay: null });
35
19
  const watcher = jest.fn();
36
20
 
37
- const { container, findByText } = render(
21
+ const rendered = render(
38
22
  <TestFormWrapper watcher={watcher} context={{ type: "any" }}>
39
23
  <ConstantSelector />
40
- </TestFormWrapper>,
41
- renderOpts
24
+ </TestFormWrapper>
42
25
  );
26
+ await waitForLoad(rendered);
43
27
 
44
- userEvent.click(await findByText("boolean"));
45
- userEvent.click(await findByText("true"));
28
+ await user.click(await rendered.findByText(/boolean/i));
29
+ await user.click(await rendered.findByText(/true/i));
46
30
 
47
31
  expect(watcher).toHaveBeenLastCalledWith({
48
32
  test: {
@@ -53,7 +37,7 @@ describe("<ConstantSelector />", () => {
53
37
  },
54
38
  });
55
39
 
56
- userEvent.click(await findByText("string"));
40
+ await user.click(await rendered.findByText(/string/i));
57
41
 
58
42
  expect(watcher).toHaveBeenLastCalledWith({
59
43
  test: {
@@ -64,6 +48,6 @@ describe("<ConstantSelector />", () => {
64
48
  },
65
49
  });
66
50
 
67
- expect(container).toMatchSnapshot();
51
+ expect(rendered.container).toMatchSnapshot();
68
52
  });
69
53
  });
@@ -1,37 +1,20 @@
1
- import React from "react";
2
- import { waitFor } from "@testing-library/react";
3
- import { render } from "@truedat/test/render";
4
1
  import userEvent from "@testing-library/user-event";
2
+ import { render, waitForLoad } from "@truedat/test/render";
5
3
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
6
4
  import Expression from "../Expression";
7
5
 
8
- const renderOpts = {
9
- messages: {
10
- en: {
11
- "functions.expression.constant.false": "false",
12
- "functions.expression.constant.true": "true",
13
- "functions.form.required": "required",
14
- "functions.expression.shape.function": "function",
15
- "functions.expression.shape.constant": "constant",
16
- "functions.expression.shape.param": "param",
17
- "functions.form.expression.function.placeholder": "function.placeholder",
18
- },
19
- },
20
- fallback: "lazy",
21
- };
22
-
23
6
  describe("<Expression />", () => {
24
7
  it("matches the latest snapshot", async () => {
25
- const { container, queryByText } = render(
8
+ const rendered = render(
26
9
  <TestFormWrapper>
27
10
  <Expression />
28
- </TestFormWrapper>,
29
- renderOpts
11
+ </TestFormWrapper>
30
12
  );
31
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
32
- expect(container).toMatchSnapshot();
13
+ await waitForLoad(rendered);
14
+ expect(rendered.container).toMatchSnapshot();
33
15
  });
34
16
  it("shape function expression", async () => {
17
+ const user = userEvent.setup({ delay: null });
35
18
  const watcher = jest.fn();
36
19
  const functions = [
37
20
  {
@@ -48,43 +31,53 @@ describe("<Expression />", () => {
48
31
  shape: "function",
49
32
  },
50
33
  };
51
- const { container, getByRole, getAllByRole, queryByText } = render(
34
+
35
+ const rendered = render(
52
36
  <TestFormWrapper
53
37
  watcher={watcher}
54
38
  context={{ type: "boolean", functions }}
55
39
  defaultValues={defaultValues}
56
40
  >
57
41
  <Expression />
58
- </TestFormWrapper>,
59
- renderOpts
42
+ </TestFormWrapper>
43
+ );
44
+ await waitForLoad(rendered);
45
+
46
+ await user.click(
47
+ await rendered.findByRole("option", { name: /shape.function/i })
60
48
  );
61
- const listboxes = await waitFor(() => getAllByRole("listbox"));
62
- const listbox = listboxes[0];
63
- userEvent.click(listbox);
64
- const option = await waitFor(() => getByRole("option", { name: /eq/i }));
65
- userEvent.click(option);
49
+ await user.click(await rendered.findByRole("option", { name: /eq/i }));
50
+
51
+ await waitForLoad(rendered);
66
52
  expect(watcher).toHaveBeenLastCalledWith({
67
53
  test: {
68
54
  shape: "function",
69
55
  value: {
56
+ args: {
57
+ arg1: { shape: "function", value: undefined },
58
+ arg2: { shape: "function", value: undefined },
59
+ },
70
60
  name: "eq",
71
61
  type: "boolean",
72
62
  },
73
63
  },
74
64
  });
75
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
76
- expect(container).toMatchSnapshot();
65
+ await waitForLoad(rendered);
66
+ expect(rendered.container).toMatchSnapshot();
77
67
  });
78
68
  it("shape constant expression", async () => {
69
+ const user = userEvent.setup({ delay: null });
79
70
  const watcher = jest.fn();
80
- const { container, getByRole, getAllByRole, queryByText } = render(
71
+
72
+ const rendered = render(
81
73
  <TestFormWrapper watcher={watcher} context={{ type: "boolean" }}>
82
74
  <Expression />
83
- </TestFormWrapper>,
84
- renderOpts
75
+ </TestFormWrapper>
85
76
  );
86
- userEvent.click(getAllByRole("listbox")[0]);
87
- userEvent.click(getByRole("option", { name: /constant/i }));
77
+ await waitForLoad(rendered);
78
+
79
+ await user.click(rendered.getByRole("option", { name: /constant/i }));
80
+
88
81
  expect(watcher).toHaveBeenLastCalledWith({
89
82
  test: {
90
83
  shape: "constant",
@@ -93,35 +86,35 @@ describe("<Expression />", () => {
93
86
  },
94
87
  },
95
88
  });
96
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument(), {
97
- timeout: 10000,
98
- });
99
- expect(container).toMatchSnapshot();
89
+
90
+ expect(rendered.container).toMatchSnapshot();
100
91
  });
101
92
  it("shape param expression", async () => {
93
+ const user = userEvent.setup({ delay: null });
102
94
  const watcher = jest.fn();
103
95
  const defaultValues = {
104
96
  params: [{ name: "param1", type: "boolean", id: 1 }],
105
97
  };
106
- const { container, getByRole, getAllByRole, queryByText } = render(
98
+
99
+ const rendered = render(
107
100
  <TestFormWrapper
108
101
  watcher={watcher}
109
102
  context={{ type: "boolean" }}
110
103
  defaultValues={defaultValues}
111
104
  >
112
105
  <Expression />
113
- </TestFormWrapper>,
114
- renderOpts
106
+ </TestFormWrapper>
115
107
  );
116
- userEvent.click(getAllByRole("listbox")[0]);
117
- userEvent.click(getByRole("option", { name: /param/i }));
108
+ await waitForLoad(rendered);
109
+
110
+ await user.click(rendered.getByRole("option", { name: /param/i }));
111
+ // userEvent.click(getAllByRole("listbox")[0]);
112
+ // userEvent.click(getByRole("option", { name: /param/i }));
118
113
  expect(watcher).toHaveBeenLastCalledWith({
119
114
  params: [{ name: "param1", type: "boolean", id: 1 }],
120
115
  test: { shape: "param", value: { id: undefined } },
121
116
  });
122
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument(), {
123
- timeout: 10000,
124
- });
125
- expect(container).toMatchSnapshot();
117
+
118
+ expect(rendered.container).toMatchSnapshot();
126
119
  });
127
120
  });
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { render } from "@truedat/test/render";
3
2
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
4
3
  import FieldSelector from "../FieldSelector";
@@ -7,17 +6,13 @@ describe("<FieldSelector />", () => {
7
6
  it("matches the latest snapshot", () => {
8
7
  const fields = [{ id: 1, parent_id: 2, name: "name" }];
9
8
  const { container } = render(
10
- <TestFormWrapper context={{ fields }}>
11
- <FieldSelector />
12
- </TestFormWrapper>
9
+ <TestFormWrapper context={{ fields }}><FieldSelector /></TestFormWrapper>
13
10
  );
14
11
  expect(container).toMatchSnapshot();
15
12
  });
16
13
  it("matches the latest snapshot empty", () => {
17
14
  const { container } = render(
18
- <TestFormWrapper>
19
- <FieldSelector />
20
- </TestFormWrapper>
15
+ <TestFormWrapper><FieldSelector /></TestFormWrapper>
21
16
  );
22
17
  expect(container).toMatchSnapshot();
23
18
  });
@@ -1,8 +1,6 @@
1
- import React from "react";
2
- import { waitFor } from "@testing-library/react";
3
- import { act } from "react-dom/test-utils";
4
- import { render } from "@truedat/test/render";
5
1
  import userEvent from "@testing-library/user-event";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { render, waitForLoad } from "@truedat/test/render";
6
4
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
7
5
  import FunctionArgs from "../FunctionArgs";
8
6
 
@@ -32,38 +30,19 @@ jest.mock("@truedat/dd/hooks/useStructures", () => {
32
30
  };
33
31
  });
34
32
 
35
- const renderOpts = {
36
- messages: {
37
- en: {
38
- "functions.expression.shape.function": "function",
39
- "functions.expression.shape.constant": "constant",
40
- "functions.form.expression.function.placeholder": "function.placeholder",
41
- "functions.form.required": "required",
42
- "expressions.data_type.timestamp": "timestamp",
43
- "expressions.data_type.date": "date",
44
- "expressions.data_type.number": "number",
45
- "expressions.data_type.string": "string",
46
- "expressions.data_type.boolean": "boolean",
47
- "expressions.data_type.any": "any",
48
- "functions.expression.constant.false": "false",
49
- "functions.expression.constant.true": "true",
50
- },
51
- },
52
- fallback: "lazy",
53
- };
54
-
55
33
  describe("<FunctionArgs />", () => {
56
- it("matches the latest snapshot", () => {
57
- const { container } = render(
34
+ it("matches the latest snapshot", async () => {
35
+ const rendered = render(
58
36
  <TestFormWrapper>
59
37
  <FunctionArgs />
60
- </TestFormWrapper>,
61
- renderOpts
38
+ </TestFormWrapper>
62
39
  );
63
- expect(container).toMatchSnapshot();
40
+ await waitForLoad(rendered);
41
+ expect(rendered.container).toMatchSnapshot();
64
42
  });
65
43
 
66
44
  it("user interaction", async () => {
45
+ const user = userEvent.setup({ delay: null });
67
46
  const watcher = jest.fn();
68
47
 
69
48
  const functions = [
@@ -87,32 +66,27 @@ describe("<FunctionArgs />", () => {
87
66
  },
88
67
  };
89
68
 
90
- const { container, getAllByRole, queryByText, getByRole } = render(
69
+ const rendered = render(
91
70
  <TestFormWrapper
92
71
  watcher={watcher}
93
72
  context={{ type: "boolean", functions }}
94
73
  defaultValues={defaultValues}
95
74
  >
96
75
  <FunctionArgs />
97
- </TestFormWrapper>,
98
- renderOpts
76
+ </TestFormWrapper>
99
77
  );
100
- await waitFor(() => {
101
- expect(queryByText(/lazy/i)).not.toBeInTheDocument();
102
- expect(container.querySelector(".loader")).not.toBeInTheDocument();
103
- });
104
-
105
- userEvent.click(getAllByRole("listbox")[0]);
78
+ await waitForLoad(rendered);
106
79
 
107
- act(() =>
108
- userEvent.click(getAllByRole("option", { name: /constant/i })[0])
109
- );
80
+ await user.click(rendered.getAllByRole("listbox")[0]);
81
+ await user.click(rendered.getAllByRole("option", { name: /constant/i })[0]);
110
82
 
111
83
  await waitFor(() => {
112
- expect(getByRole("option", { name: /true/i })).toBeInTheDocument();
84
+ expect(
85
+ rendered.getByRole("option", { name: /true/i })
86
+ ).toBeInTheDocument();
113
87
  });
114
88
 
115
- userEvent.click(getByRole("option", { name: /true/i }));
89
+ await user.click(rendered.getByRole("option", { name: /true/i }));
116
90
 
117
91
  expect(watcher).toHaveBeenLastCalledWith({
118
92
  test: {
@@ -134,6 +108,6 @@ describe("<FunctionArgs />", () => {
134
108
  },
135
109
  });
136
110
 
137
- expect(container).toMatchSnapshot();
111
+ expect(rendered.container).toMatchSnapshot();
138
112
  });
139
113
  });
@@ -1,33 +1,21 @@
1
- import React from "react";
2
- import { waitFor } from "@testing-library/react";
3
- import { render } from "@truedat/test/render";
4
1
  import userEvent from "@testing-library/user-event";
2
+ import { render, waitForLoad } from "@truedat/test/render";
5
3
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
6
4
  import FunctionSelector from "../FunctionSelector";
7
5
 
8
- const renderOpts = {
9
- messages: {
10
- en: {
11
- "functions.expression.shape.function": "function",
12
- "functions.expression.shape.constant": "constant",
13
- "functions.form.expression.function.placeholder": "function.placeholder",
14
- },
15
- },
16
- fallback: "lazy",
17
- };
18
-
19
6
  describe("<FunctionSelector />", () => {
20
- it("matches the latest snapshot", () => {
21
- const { container } = render(
7
+ it("matches the latest snapshot", async () => {
8
+ const rendered = render(
22
9
  <TestFormWrapper>
23
10
  <FunctionSelector />
24
- </TestFormWrapper>,
25
- renderOpts
11
+ </TestFormWrapper>
26
12
  );
27
- expect(container).toMatchSnapshot();
13
+ await waitForLoad(rendered);
14
+ expect(rendered.container).toMatchSnapshot();
28
15
  });
29
16
 
30
17
  it("user interaction", async () => {
18
+ const user = userEvent.setup({ delay: null });
31
19
  const watcher = jest.fn();
32
20
 
33
21
  const functions = [
@@ -41,15 +29,14 @@ describe("<FunctionSelector />", () => {
41
29
  },
42
30
  ];
43
31
 
44
- const { container, getByRole, queryByText } = render(
32
+ const rendered = render(
45
33
  <TestFormWrapper watcher={watcher} context={{ type: "any", functions }}>
46
34
  <FunctionSelector />
47
- </TestFormWrapper>,
48
- renderOpts
35
+ </TestFormWrapper>
49
36
  );
50
- await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
37
+ await waitForLoad(rendered);
51
38
 
52
- userEvent.click(await getByRole("option", { name: /eq/i }));
39
+ await user.click(rendered.getByRole("option", { name: /eq/i }));
53
40
 
54
41
  expect(watcher).toHaveBeenLastCalledWith({
55
42
  test: {
@@ -60,10 +47,15 @@ describe("<FunctionSelector />", () => {
60
47
  },
61
48
  });
62
49
 
63
- expect(container).toMatchSnapshot();
50
+ await waitForLoad(rendered);
51
+
52
+ expect(rendered.container).toMatchSnapshot();
64
53
 
65
- userEvent.click(container.getElementsByClassName("no-padding")[0]);
54
+ await user.click(
55
+ rendered.container.getElementsByClassName("no-padding")[0]
56
+ );
66
57
 
67
- expect(container).toMatchSnapshot();
58
+ await waitForLoad(rendered);
59
+ expect(rendered.container).toMatchSnapshot();
68
60
  });
69
61
  });