@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,7 +1,6 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { Link } from "react-router";
3
3
  import PropTypes from "prop-types";
4
- import { Link } from "react-router-dom";
5
4
  import { FormattedMessage } from "react-intl";
6
5
  import { DateDecorator } from "@truedat/core/services/columnDecorators";
7
6
  import { linkTo } from "@truedat/core/routes";
@@ -1,4 +1,4 @@
1
- import React, { useContext } from "react";
1
+ import { use } from "react";
2
2
  import { useIntl } from "react-intl";
3
3
  import { Controller, useFormContext } from "react-hook-form";
4
4
  import { Form } from "semantic-ui-react";
@@ -8,7 +8,7 @@ import { numberRules } from "@truedat/core/services/formRules";
8
8
 
9
9
  export default function Deviation() {
10
10
  const { formatMessage } = useIntl();
11
- const { field } = useContext(QxContext);
11
+ const { field } = use(QxContext);
12
12
  const { control, watch } = useFormContext();
13
13
 
14
14
  const maximumField = `${field}.maximum`;
@@ -1,4 +1,4 @@
1
- import React, { useContext } from "react";
1
+ import { use } from "react";
2
2
  import { useIntl } from "react-intl";
3
3
  import { Controller, useFormContext } from "react-hook-form";
4
4
  import { Form } from "semantic-ui-react";
@@ -8,7 +8,7 @@ import { numberRules } from "@truedat/core/services/formRules";
8
8
 
9
9
  export default function ErrorCount() {
10
10
  const { formatMessage } = useIntl();
11
- const { field } = useContext(QxContext);
11
+ const { field } = use(QxContext);
12
12
  const { control, watch } = useFormContext();
13
13
 
14
14
  const maximumField = `${field}.maximum`;
@@ -68,8 +68,7 @@ export default function ErrorCount() {
68
68
  label={formatMessage({
69
69
  id: "quality_control.score_criteria.error_count.maximum",
70
70
  })}
71
- required
72
- error={error?.message}
71
+ error={!!error}
73
72
  >
74
73
  <Form.Input
75
74
  autoComplete="off"
@@ -1,4 +1,4 @@
1
- import React, { useContext } from "react";
1
+ import { use } from "react";
2
2
  import { useIntl } from "react-intl";
3
3
  import { Controller, useFormContext } from "react-hook-form";
4
4
  import { Form } from "semantic-ui-react";
@@ -8,7 +8,7 @@ import { numberRules } from "@truedat/core/services/formRules";
8
8
 
9
9
  export default function Percentage() {
10
10
  const { formatMessage } = useIntl();
11
- const { field } = useContext(QxContext);
11
+ const { field } = use(QxContext);
12
12
  const { control, watch } = useFormContext();
13
13
 
14
14
  const minimumField = `${field}.minimum`;
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { render } from "@truedat/test/render";
3
2
  import { waitFor } from "@testing-library/react";
4
3
  import { fireEvent } from "@testing-library/react";
@@ -1,75 +1,71 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import userEvent from "@testing-library/user-event";
3
2
  import { waitFor } from "@testing-library/react";
4
- import { fireEvent } from "@testing-library/react";
3
+ import { render, waitForLoad } from "@truedat/test/render";
5
4
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
6
5
  import ErrorCount from "../ErrorCount";
7
6
 
8
- const messages = {
9
- en: {
10
- "form.validation.must_be_a_number": "Must be a number",
11
- "form.validation.must_be_less_than_or_equal": "Must be less than x",
12
- "form.validation.must_be_greater_than_or_equal": "Must be greater than y",
13
- "form.validation.empty_required": "Required field is empty",
14
- "quality_control.score_criteria.error_count.goal": "Goal",
15
- "quality_control.score_criteria.error_count.maximum": "Threshold",
16
- },
17
- };
18
-
19
- const renderOpts = {
20
- messages,
21
- };
22
-
23
7
  describe("<ErrorCount />", () => {
24
8
  it("matches the latest snapshot", async () => {
25
- const { container } = render(
9
+ const rendered = render(
26
10
  <TestFormWrapper>
27
11
  <ErrorCount />
28
- </TestFormWrapper>,
29
- renderOpts
12
+ </TestFormWrapper>
30
13
  );
31
-
32
- expect(container).toMatchSnapshot();
14
+ await waitForLoad(rendered);
15
+ expect(rendered.container).toMatchSnapshot();
33
16
  });
34
17
 
35
18
  it("should update the goal and maximum fields correctly", async () => {
36
19
  const defaultValues = { "testField.goal": "", "testField.maximum": "" };
37
-
38
- const { getByPlaceholderText, queryByText } = render(
20
+ const rendered = render(
39
21
  <TestFormWrapper defaultValues={defaultValues}>
40
22
  <ErrorCount />
41
- </TestFormWrapper>,
42
- renderOpts
23
+ </TestFormWrapper>
43
24
  );
25
+ await waitForLoad(rendered);
44
26
 
45
- const goalInput = getByPlaceholderText("Goal");
46
-
47
- const thresholdInput = getByPlaceholderText("Threshold");
27
+ const user = userEvent.setup({ delay: null });
28
+ const goalInput = rendered.getByPlaceholderText(
29
+ "quality_control.score_criteria.error_count.goal"
30
+ );
31
+ const thresholdInput = rendered.getByPlaceholderText(
32
+ "quality_control.score_criteria.error_count.maximum"
33
+ );
48
34
 
49
- fireEvent.change(goalInput, { target: { value: "10" } });
50
- fireEvent.change(thresholdInput, { target: { value: "20" } });
35
+ await user.type(goalInput, "10");
36
+ await user.type(thresholdInput, "20");
37
+ rendered.debug();
51
38
  await waitFor(() =>
52
- expect(queryByText(/Must be greater than y/i)).not.toBeInTheDocument()
39
+ expect(
40
+ rendered.queryByText(/must be greater than y/i)
41
+ ).not.toBeInTheDocument()
53
42
  );
54
43
  });
55
44
 
56
- it("Show alert if thresholdInput is less than goal", async () => {
57
- const { getByPlaceholderText, queryByText } = render(
45
+ it.skip("Show alert if thresholdInput is less than goal", async () => {
46
+ const rendered = render(
58
47
  <TestFormWrapper>
59
48
  <ErrorCount />
60
- </TestFormWrapper>,
61
- renderOpts
49
+ </TestFormWrapper>
62
50
  );
51
+ await waitForLoad(rendered);
63
52
 
64
- const goalInput = getByPlaceholderText("Goal");
65
-
66
- const thresholdInput = getByPlaceholderText("Threshold");
53
+ const user = userEvent.setup({ delay: null });
54
+ const goalInput = rendered.getByPlaceholderText(
55
+ "quality_control.score_criteria.error_count.goal"
56
+ );
57
+ const thresholdInput = rendered.getByPlaceholderText(
58
+ "quality_control.score_criteria.error_count.maximum"
59
+ );
67
60
 
68
- fireEvent.change(goalInput, { target: { value: "10" } });
69
- fireEvent.change(thresholdInput, { target: { value: "1" } });
61
+ await user.type(goalInput, "10");
62
+ await user.type(thresholdInput, "1");
63
+ await waitForLoad(rendered);
70
64
 
71
65
  await waitFor(() =>
72
- expect(queryByText(/Must be greater than y/i)).toBeInTheDocument()
66
+ expect(
67
+ rendered.queryByText(/must be greater than 10/i)
68
+ ).toBeInTheDocument()
73
69
  );
74
70
  });
75
71
  });
@@ -1,7 +1,6 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import userEvent from "@testing-library/user-event";
3
2
  import { waitFor } from "@testing-library/react";
4
- import { fireEvent } from "@testing-library/react";
3
+ import { render, waitForLoad } from "@truedat/test/render";
5
4
  import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
6
5
  import { messages } from "@truedat/qx/components/__tests__/__fixtures__/helper";
7
6
  import Percentage from "../Percentage";
@@ -10,52 +9,57 @@ const renderOpts = { messages };
10
9
 
11
10
  describe("<Percentage />", () => {
12
11
  it("matches the latest snapshot", async () => {
13
- const { container } = render(
12
+ const rendered = render(
14
13
  <TestFormWrapper>
15
14
  <Percentage />
16
15
  </TestFormWrapper>,
17
16
  renderOpts
18
17
  );
19
-
20
- expect(container).toMatchSnapshot();
18
+ await waitForLoad(rendered);
19
+ expect(rendered.container).toMatchSnapshot();
21
20
  });
22
21
 
23
22
  it("should update the goal and maximum fields correctly", async () => {
24
- const { getByPlaceholderText, queryByText } = render(
23
+ const user = userEvent.setup({ delay: null });
24
+ const rendered = render(
25
25
  <TestFormWrapper>
26
26
  <Percentage />
27
27
  </TestFormWrapper>,
28
28
  renderOpts
29
29
  );
30
+ await waitForLoad(rendered);
30
31
 
31
- const goalInput = getByPlaceholderText("Goal");
32
+ const goalInput = rendered.getByPlaceholderText(/goal/i);
33
+ const thresholdInput = rendered.getByPlaceholderText(/threshold/i);
32
34
 
33
- const thresholdInput = getByPlaceholderText("Threshold");
35
+ await user.type(goalInput, "20");
36
+ await user.type(thresholdInput, "10");
34
37
 
35
- fireEvent.change(goalInput, { target: { value: "20" } });
36
- fireEvent.change(thresholdInput, { target: { value: "10" } });
37
38
  await waitFor(() =>
38
- expect(queryByText(/Must be less than 10/i)).not.toBeInTheDocument()
39
+ expect(
40
+ rendered.queryByText(/must be less than 10/i)
41
+ ).not.toBeInTheDocument()
39
42
  );
40
43
  });
41
44
 
42
45
  it("Show alert if thresholdInput is more than goal", async () => {
43
- const { getByPlaceholderText, queryByText } = render(
46
+ const user = userEvent.setup({ delay: null });
47
+ const rendered = render(
44
48
  <TestFormWrapper>
45
49
  <Percentage />
46
50
  </TestFormWrapper>,
47
51
  renderOpts
48
52
  );
53
+ await waitForLoad(rendered);
49
54
 
50
- const goalInput = getByPlaceholderText("Goal");
51
-
52
- const thresholdInput = getByPlaceholderText("Threshold");
55
+ const goalInput = rendered.getByPlaceholderText(/goal/i);
56
+ const thresholdInput = rendered.getByPlaceholderText(/threshold/i);
53
57
 
54
- fireEvent.change(goalInput, { target: { value: "10" } });
55
- fireEvent.change(thresholdInput, { target: { value: "20" } });
58
+ await user.type(goalInput, "10");
59
+ await user.type(thresholdInput, "20");
56
60
 
57
61
  await waitFor(() =>
58
- expect(queryByText(/Must be less than 10/i)).toBeInTheDocument()
62
+ expect(rendered.queryByText(/must be less than 10/i)).toBeInTheDocument()
59
63
  );
60
64
  });
61
65
  });
@@ -8,7 +8,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
8
8
  <label
9
9
  class="field-label"
10
10
  >
11
- Goal
11
+ quality_control.score_criteria.error_count.goal
12
12
  <span>
13
13
  *
14
14
  </span>
@@ -21,7 +21,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
21
21
  >
22
22
  <input
23
23
  autocomplete="off"
24
- placeholder="Goal"
24
+ placeholder="quality_control.score_criteria.error_count.goal"
25
25
  type="text"
26
26
  value=""
27
27
  />
@@ -34,10 +34,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
34
34
  <label
35
35
  class="field-label"
36
36
  >
37
- Threshold
38
- <span>
39
- *
40
- </span>
37
+ quality_control.score_criteria.error_count.maximum
41
38
  </label>
42
39
  <div
43
40
  class="field"
@@ -47,7 +44,7 @@ exports[`<ErrorCount /> matches the latest snapshot 1`] = `
47
44
  >
48
45
  <input
49
46
  autocomplete="off"
50
- placeholder="Threshold"
47
+ placeholder="quality_control.score_criteria.error_count.maximum"
51
48
  type="text"
52
49
  value=""
53
50
  />
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { FormattedMessage } from "react-intl";
4
3
  import { Header, Icon, Grid, Segment, Divider } from "semantic-ui-react";
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useContext } from "react";
2
+ import { use } from "react";
3
3
  import { Popup } from "semantic-ui-react";
4
4
  import { FormattedMessage, useIntl } from "react-intl";
5
5
  import Moment from "react-moment";
@@ -7,7 +7,7 @@ import qualityByControlMode from "../qualityControls/qualityByControlMode";
7
7
  import ScoreContext from "./ScoreContext";
8
8
 
9
9
  export default function QualityBar() {
10
- const { score } = useContext(ScoreContext);
10
+ const { score } = use(ScoreContext);
11
11
  const { formatMessage } = useIntl();
12
12
  const quality = qualityByControlMode(score);
13
13
 
@@ -17,28 +17,28 @@ export default function QualityBar() {
17
17
  text: formatMessage({ id: "score.status.failed" }),
18
18
  }
19
19
  : quality.isEmpty
20
- ? {
21
- color: "notExecutedDataset",
22
- text: formatMessage({ id: "quality.result.no.data" }),
23
- }
24
- : score.score_content.total_count == 0
25
- ? {
26
- color: "empyDataset",
27
- text: formatMessage(
28
- {
29
- id: "score.empty_dataset_date",
30
- },
31
- {
32
- date: (
33
- <Moment
34
- date={score.execution_timestamp}
35
- format="YYYY-MM-DD HH:mm"
36
- />
20
+ ? {
21
+ color: "notExecutedDataset",
22
+ text: formatMessage({ id: "quality.result.no.data" }),
23
+ }
24
+ : score.score_content.total_count == 0
25
+ ? {
26
+ color: "empyDataset",
27
+ text: formatMessage(
28
+ {
29
+ id: "score.empty_dataset_date",
30
+ },
31
+ {
32
+ date: (
33
+ <Moment
34
+ date={score.execution_timestamp}
35
+ format="YYYY-MM-DD HH:mm"
36
+ />
37
+ ),
38
+ }
37
39
  ),
38
40
  }
39
- ),
40
- }
41
- : quality;
41
+ : quality;
42
42
 
43
43
  const propsByColor = {
44
44
  red: {
@@ -70,7 +70,9 @@ export default function QualityBar() {
70
70
  tooltip: "failed",
71
71
  },
72
72
  };
73
+
73
74
  const summaryProps = propsByColor[color];
75
+
74
76
  return (
75
77
  <div className="quality-bar-wrapper">
76
78
  <div className="quality-bar">
@@ -1,6 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
- import { useParams } from "react-router-dom";
2
+ import { useParams, Outlet } from "react-router";
4
3
  import { FormattedMessage } from "react-intl";
5
4
  import { Segment, Header, Icon } from "semantic-ui-react";
6
5
  import { useScoreShow } from "../../hooks/useScores";
@@ -14,7 +13,7 @@ export default function Score({ children }) {
14
13
  const { data: score } = useScoreShow(id);
15
14
 
16
15
  return score ? (
17
- <ScoreContext.Provider value={{ score }}>
16
+ <ScoreContext value={{ score }}>
18
17
  <ScoreCrumbs />
19
18
  <Segment>
20
19
  <Header as="h2">
@@ -25,8 +24,8 @@ export default function Score({ children }) {
25
24
  </Header.Content>
26
25
  </Header>
27
26
  <ScoreTabs />
28
- {children}
27
+ {children ? children : <Outlet />}
29
28
  </Segment>
30
- </ScoreContext.Provider>
29
+ </ScoreContext>
31
30
  ) : null;
32
31
  }
@@ -1,14 +1,14 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useContext } from "react";
2
+ import { use } from "react";
3
3
  import { Breadcrumb } from "semantic-ui-react";
4
- import { Link } from "react-router-dom";
4
+ import { Link } from "react-router";
5
5
  import { FormattedMessage } from "react-intl";
6
6
  import { QUALITY_CONTROLS, linkTo } from "@truedat/core/routes";
7
7
  import { DateDecorator } from "@truedat/core/services/columnDecorators";
8
8
  import ScoreContext from "./ScoreContext";
9
9
 
10
10
  export default function ScoreCrumbs() {
11
- const { score } = useContext(ScoreContext);
11
+ const { score } = use(ScoreContext);
12
12
  const qualityControl = _.prop("quality_control")(score);
13
13
  const executionTimestamp = _.prop("execution_timestamp")(score);
14
14
 
@@ -17,9 +17,7 @@ export default function ScoreCrumbs() {
17
17
  <Breadcrumb.Section as={Link} to={QUALITY_CONTROLS} active={false}>
18
18
  <FormattedMessage id="quality_controls.header" />
19
19
  </Breadcrumb.Section>
20
-
21
20
  <Breadcrumb.Divider icon="right angle" />
22
-
23
21
  <Breadcrumb.Section
24
22
  as={Link}
25
23
  to={linkTo.QUALITY_CONTROL_SCORES({
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useContext } from "react";
2
+ import { use } from "react";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { Header, Icon, List, Segment } from "semantic-ui-react";
5
5
  import { columnDecorator } from "@truedat/core/services";
@@ -7,7 +7,7 @@ import columns from "../qualityControls/qualityControlScoresColumns";
7
7
  import ScoreContext from "./ScoreContext";
8
8
 
9
9
  export default function ScoreDetails() {
10
- const { score } = useContext(ScoreContext);
10
+ const { score } = use(ScoreContext);
11
11
  const details = _.prop("details")(score);
12
12
 
13
13
  return (
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useContext } from "react";
2
+ import { use } from "react";
3
3
  import { useIntl, FormattedMessage } from "react-intl";
4
4
  import { Table } from "semantic-ui-react";
5
5
  import { columnDecorator } from "@truedat/core/services";
@@ -24,7 +24,7 @@ const columns = [
24
24
  },
25
25
  ];
26
26
  export default function ScoreEvents() {
27
- const { score } = useContext(ScoreContext);
27
+ const { score } = use(ScoreContext);
28
28
  const { formatMessage } = useIntl();
29
29
 
30
30
  const events = _.prop("events")(score);
@@ -1,7 +1,8 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { lazy } from "react";
3
3
  import { useIntl } from "react-intl";
4
- import { useParams, Link } from "react-router-dom";
4
+ import { Link } from "react-router";
5
+ import { useParams } from "react-router";
5
6
  import { Table } from "semantic-ui-react";
6
7
  import { columnDecorator } from "@truedat/core/services";
7
8
  import { linkTo } from "@truedat/core/routes";
@@ -10,8 +11,8 @@ import ScoreGroupMessage from "./ScoreGroupMessage";
10
11
  import ScoreStatusDecorator from "./ScoreStatusDecorator";
11
12
  import ScoreGroupBreadcrumbs from "./ScoreGroupBreadcrumbs";
12
13
 
13
- const DynamicFormViewer = React.lazy(() =>
14
- import("@truedat/df/components/DynamicFormViewer")
14
+ const DynamicFormViewer = lazy(
15
+ () => import("@truedat/df/components/DynamicFormViewer")
15
16
  );
16
17
 
17
18
  const QualityControlLink = ({ id, name, version }) => (
@@ -1,7 +1,6 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { Breadcrumb } from "semantic-ui-react";
4
- import { Link } from "react-router-dom";
3
+ import { Link } from "react-router";
5
4
  import { FormattedMessage } from "react-intl";
6
5
  import { DateTime } from "@truedat/core/components";
7
6
  import { MY_SCORE_GROUPS } from "@truedat/core/routes";
@@ -1,14 +1,12 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState } from "react";
2
+ import { lazy, useState } from "react";
3
3
  import { Button, Form, Header } from "semantic-ui-react";
4
4
  import PropTypes from "prop-types";
5
5
  import { useIntl } from "react-intl";
6
6
  import { TemplateSelector } from "@truedat/core/components";
7
7
  import { validateContent } from "@truedat/df/utils";
8
8
 
9
- const DynamicForm = React.lazy(() =>
10
- import("@truedat/df/components/DynamicForm")
11
- );
9
+ const DynamicForm = lazy(() => import("@truedat/df/components/DynamicForm"));
12
10
 
13
11
  export default function ScoreGroupForm({ count, onSubmit, onCancel }) {
14
12
  const { formatMessage } = useIntl();
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
- import { Link } from "react-router-dom";
2
+ import { Link } from "react-router";
4
3
  import { DateTime } from "@truedat/core/components";
5
4
  import { linkTo } from "@truedat/core/routes";
6
5
 
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { useIntl } from "react-intl";
4
3
  import { Message } from "semantic-ui-react";
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { useIntl } from "react-intl";
4
4
  import { Button, Popup } from "semantic-ui-react";
@@ -0,0 +1,19 @@
1
+ import { Route, Routes } from "react-router";
2
+ import {
3
+ MY_SCORE_GROUPS,
4
+ SCORE_GROUP,
5
+ SCORE,
6
+ SCORE_EVENTS,
7
+ } from "@truedat/core/routes";
8
+
9
+ import { MyScoreGroups, ScoreGroup } from ".";
10
+ import "../../styles/scores.less";
11
+
12
+ export default function ScoreGroupsRoutes() {
13
+ return (
14
+ <Routes>
15
+ <Route index element={<MyScoreGroups />} />
16
+ <Route path=":id" element={<ScoreGroup />} />
17
+ </Routes>
18
+ );
19
+ }