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