@truedat/dq 4.56.1 → 4.56.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +5 -5
- package/src/api/queries.js +37 -9
- package/src/components/ConditionSummary.js +5 -5
- package/src/components/ImplementationExecutions.js +30 -30
- package/src/components/NewRuleImplementation.js +15 -14
- package/src/components/RuleImplementationResults.js +37 -24
- package/src/components/RuleResultRow.js +4 -1
- package/src/components/RuleResultsTable.js +32 -25
- package/src/components/__tests__/ConditionSummary.spec.js +12 -1
- package/src/components/__tests__/RuleImplementationResults.spec.js +18 -65
- package/src/components/__tests__/__fixtures__/NewRuleImplementationProps.js +11 -0
- package/src/components/__tests__/__fixtures__/implementationResultsMocks.js +137 -0
- package/src/components/__tests__/__snapshots__/ConditionSummary.spec.js.snap +1 -0
- package/src/components/__tests__/__snapshots__/ImplementationExecutions.spec.js.snap +24 -28
- package/src/components/__tests__/__snapshots__/NewRuleImplementation.spec.js.snap +26 -7
- package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +216 -177
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.56.3] 2022-11-24
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-5286] Implementation results pagination
|
|
8
|
+
|
|
9
|
+
## [4.56.2] 2022-11-24
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-5247] Display the name of the table together with field in implementations
|
|
14
|
+
details
|
|
15
|
+
|
|
3
16
|
## [4.54.12] 2022-11-14
|
|
4
17
|
|
|
5
18
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.56.
|
|
3
|
+
"version": "4.56.3",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.56.
|
|
37
|
+
"@truedat/test": "4.56.3",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@apollo/client": "^3.7.0",
|
|
96
|
-
"@truedat/core": "4.56.
|
|
97
|
-
"@truedat/df": "4.56.
|
|
96
|
+
"@truedat/core": "4.56.3",
|
|
97
|
+
"@truedat/df": "4.56.3",
|
|
98
98
|
"graphql": "^15.5.3",
|
|
99
99
|
"path-to-regexp": "^1.7.0",
|
|
100
100
|
"prop-types": "^15.8.1",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"react-dom": ">= 16.8.6 < 17",
|
|
115
115
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "7940a71d7e8ed3eb6c1fc088cf631e37e87fd093"
|
|
118
118
|
}
|
package/src/api/queries.js
CHANGED
|
@@ -15,16 +15,17 @@ export const IMPLEMENTATION_VERSIONS_QUERY = gql`
|
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
|
-
export const
|
|
19
|
-
query Implementation(
|
|
18
|
+
export const IMPLEMENTATION_RESULTS_CONNECTION_QUERY = gql`
|
|
19
|
+
query Implementation(
|
|
20
|
+
$id: ID!
|
|
21
|
+
$after: Cursor
|
|
22
|
+
$before: Cursor
|
|
23
|
+
$last: Int
|
|
24
|
+
$first: Int
|
|
25
|
+
) {
|
|
20
26
|
implementation(id: $id) {
|
|
21
27
|
id
|
|
22
|
-
|
|
23
|
-
lastQualityEvent {
|
|
24
|
-
insertedAt
|
|
25
|
-
message
|
|
26
|
-
type
|
|
27
|
-
}
|
|
28
|
+
version
|
|
28
29
|
versions {
|
|
29
30
|
id
|
|
30
31
|
implementationKey
|
|
@@ -32,7 +33,20 @@ export const IMPLEMENTATION_RESULTS_QUERY = gql`
|
|
|
32
33
|
status
|
|
33
34
|
minimum
|
|
34
35
|
goal
|
|
35
|
-
|
|
36
|
+
}
|
|
37
|
+
lastQualityEvent {
|
|
38
|
+
insertedAt
|
|
39
|
+
message
|
|
40
|
+
type
|
|
41
|
+
}
|
|
42
|
+
resultsConnection(
|
|
43
|
+
first: $first
|
|
44
|
+
last: $last
|
|
45
|
+
before: $before
|
|
46
|
+
after: $after
|
|
47
|
+
) {
|
|
48
|
+
totalCount
|
|
49
|
+
page {
|
|
36
50
|
id
|
|
37
51
|
date
|
|
38
52
|
details
|
|
@@ -43,8 +57,22 @@ export const IMPLEMENTATION_RESULTS_QUERY = gql`
|
|
|
43
57
|
records
|
|
44
58
|
result
|
|
45
59
|
resultType
|
|
60
|
+
implementation {
|
|
61
|
+
id
|
|
62
|
+
version
|
|
63
|
+
}
|
|
64
|
+
__typename
|
|
65
|
+
}
|
|
66
|
+
pageInfo {
|
|
67
|
+
startCursor
|
|
68
|
+
endCursor
|
|
69
|
+
hasNextPage
|
|
70
|
+
hasPreviousPage
|
|
71
|
+
__typename
|
|
46
72
|
}
|
|
73
|
+
__typename
|
|
47
74
|
}
|
|
75
|
+
__typename
|
|
48
76
|
}
|
|
49
77
|
}
|
|
50
78
|
`;
|
|
@@ -125,11 +125,11 @@ OperatorMessage.propTypes = {
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
const ConditionCell = ({ row, alias, validationPopulationCondition }) => {
|
|
128
|
-
const alias_text =
|
|
129
|
-
_.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
const alias_text =
|
|
129
|
+
_.flow(
|
|
130
|
+
_.find({ index: row.structure?.parent_index }),
|
|
131
|
+
_.propOr(null, "text")
|
|
132
|
+
)(alias) || (row.structure ? _.last(row.structure.path) : null);
|
|
133
133
|
const values = getValues(row);
|
|
134
134
|
const operator = _.prop("operator")(row);
|
|
135
135
|
const { formatMessage } = useIntl();
|
|
@@ -58,33 +58,36 @@ ExecutionRow.propTypes = {
|
|
|
58
58
|
implementation: PropTypes.object,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
export const ImplementationExecutions = (
|
|
62
|
-
|
|
63
|
-
<Table
|
|
64
|
-
<Table.
|
|
65
|
-
<Table.
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
export const ImplementationExecutions = (connection) => (
|
|
62
|
+
<>
|
|
63
|
+
<Table basic="very">
|
|
64
|
+
<Table.Header>
|
|
65
|
+
<Table.Row>
|
|
66
|
+
<Table.HeaderCell width="1" textAlign="right">
|
|
67
|
+
<FormattedMessage id="ruleImplementations.props.version" />
|
|
68
|
+
</Table.HeaderCell>
|
|
69
|
+
<Table.HeaderCell width="2">
|
|
70
|
+
<FormattedMessage id="execution" />
|
|
71
|
+
</Table.HeaderCell>
|
|
72
|
+
<Table.HeaderCell width="2">
|
|
73
|
+
<FormattedMessage id="execution.latestEvent.insertedAt" />
|
|
74
|
+
</Table.HeaderCell>
|
|
75
|
+
<Table.HeaderCell width="2">
|
|
76
|
+
<FormattedMessage id="execution.latestEvent.type" />
|
|
77
|
+
</Table.HeaderCell>
|
|
78
|
+
<Table.HeaderCell>
|
|
79
|
+
<FormattedMessage id="execution.latestEvent.message" />
|
|
80
|
+
</Table.HeaderCell>
|
|
81
|
+
</Table.Row>
|
|
82
|
+
</Table.Header>
|
|
83
|
+
<Table.Body>
|
|
84
|
+
{connection.page.map((props, key) => (
|
|
85
|
+
<ExecutionRow key={key} {...props} />
|
|
86
|
+
))}
|
|
87
|
+
</Table.Body>
|
|
88
|
+
</Table>
|
|
89
|
+
<CursorPagination {...connection} />
|
|
90
|
+
</>
|
|
88
91
|
);
|
|
89
92
|
|
|
90
93
|
ImplementationExecutions.propTypes = {
|
|
@@ -111,9 +114,6 @@ export const ImplementationExecutionsLoader = () => {
|
|
|
111
114
|
<Grid.Column>
|
|
112
115
|
<ImplementationExecutionFilters />
|
|
113
116
|
</Grid.Column>
|
|
114
|
-
<Grid.Column textAlign="right">
|
|
115
|
-
<CursorPagination {...connection} />
|
|
116
|
-
</Grid.Column>
|
|
117
117
|
</Grid.Row>
|
|
118
118
|
</Grid>
|
|
119
119
|
{loading ? <Loading /> : null}
|
|
@@ -358,7 +358,7 @@ export const NewRuleImplementation = ({
|
|
|
358
358
|
}
|
|
359
359
|
);
|
|
360
360
|
|
|
361
|
-
const
|
|
361
|
+
const withAliasText = (dataset) => {
|
|
362
362
|
const duplicatedStructures = _.flow(
|
|
363
363
|
_.groupBy("structure.id"),
|
|
364
364
|
_.pickBy((x) => x.length > 1),
|
|
@@ -366,23 +366,24 @@ export const NewRuleImplementation = ({
|
|
|
366
366
|
_.map(Number)
|
|
367
367
|
)(dataset);
|
|
368
368
|
return _.map((ds) =>
|
|
369
|
-
_.
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
...ds,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
369
|
+
_.path("alias.text")(ds)
|
|
370
|
+
? ds
|
|
371
|
+
: {
|
|
372
|
+
...ds,
|
|
373
|
+
alias: {
|
|
374
|
+
...ds.alias,
|
|
375
|
+
text:
|
|
376
|
+
_.has("structure.id")(ds) &&
|
|
377
|
+
_.includes(ds.structure.id)(duplicatedStructures)
|
|
378
|
+
? `${ds.structure?.name} (${ds.alias?.index})`
|
|
379
|
+
: `${ds.structure?.name}`,
|
|
380
|
+
},
|
|
381
|
+
}
|
|
381
382
|
)(dataset);
|
|
382
383
|
};
|
|
383
384
|
|
|
384
385
|
const setDataset = (dataset) => {
|
|
385
|
-
const cleanDataset =
|
|
386
|
+
const cleanDataset = withAliasText(dataset);
|
|
386
387
|
//remove invalid references of fields in validations and populations after dataset edition
|
|
387
388
|
const datasetStructures = _.map(_.path("structure.id"))(cleanDataset);
|
|
388
389
|
const all_fields = _.flow(
|
|
@@ -4,29 +4,28 @@ import { useParams } from "react-router-dom";
|
|
|
4
4
|
import { useQuery } from "@apollo/client";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
|
-
import { Message, Divider } from "semantic-ui-react";
|
|
7
|
+
import { Segment, Message, Divider } from "semantic-ui-react";
|
|
8
8
|
import { columnDecorator } from "@truedat/core/services";
|
|
9
9
|
import { DateTime, Loading } from "@truedat/core/components";
|
|
10
|
-
import {
|
|
10
|
+
import { CursorPagination } from "@truedat/core/components";
|
|
11
|
+
import { useLocation } from "react-router-dom";
|
|
12
|
+
import queryString from "query-string";
|
|
13
|
+
import { IMPLEMENTATION_RESULTS_CONNECTION_QUERY } from "../api/queries";
|
|
11
14
|
import RuleResultsTable from "./RuleResultsTable";
|
|
12
15
|
|
|
16
|
+
export const PAGE_SIZE = 20;
|
|
17
|
+
|
|
13
18
|
export const getCustomColumnsWithData = (ruleResults, columns) =>
|
|
14
19
|
_.filter((column) =>
|
|
15
20
|
_.any(_.flow(columnDecorator(column), _.negate(_.isEmpty)))(ruleResults)
|
|
16
21
|
)(columns);
|
|
17
22
|
|
|
18
|
-
export const RuleImplementationResults = ({
|
|
23
|
+
export const RuleImplementationResults = ({ implementation, results }) => {
|
|
19
24
|
const { formatMessage, locale } = useIntl();
|
|
20
25
|
|
|
21
|
-
if (_.isEmpty(
|
|
22
|
-
|
|
23
|
-
const implementationVersions = _.propOr([], "versions")(ruleImplementation);
|
|
24
|
-
const currentImplementationVersion = _.flow(
|
|
25
|
-
_.filter((version) => version.id === ruleImplementation.id),
|
|
26
|
-
_.first
|
|
27
|
-
)(implementationVersions);
|
|
26
|
+
if (_.isEmpty(implementation)) return null;
|
|
28
27
|
|
|
29
|
-
const { lastQualityEvent } =
|
|
28
|
+
const { lastQualityEvent } = implementation;
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
<>
|
|
@@ -46,31 +45,45 @@ export const RuleImplementationResults = ({ ruleImplementation }) => {
|
|
|
46
45
|
<p style={{ whiteSpace: "pre-wrap" }}>{lastQualityEvent.message}</p>
|
|
47
46
|
</Message>
|
|
48
47
|
) : null}
|
|
49
|
-
<RuleResultsTable
|
|
50
|
-
currentImplementationVersion={currentImplementationVersion}
|
|
51
|
-
implementationVersions={implementationVersions}
|
|
52
|
-
/>
|
|
48
|
+
<RuleResultsTable implementation={implementation} results={results} />
|
|
53
49
|
</>
|
|
54
50
|
);
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
RuleImplementationResults.propTypes = {
|
|
58
|
-
|
|
54
|
+
results: PropTypes.array,
|
|
55
|
+
implementation: PropTypes.object,
|
|
59
56
|
};
|
|
60
57
|
|
|
61
58
|
export const RuleImplementationResultsLoader = (props) => {
|
|
62
59
|
const { implementation_id: id } = useParams();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
60
|
+
|
|
61
|
+
const { search } = useLocation();
|
|
62
|
+
const { before, after } = queryString.parse(search);
|
|
63
|
+
const variables = after
|
|
64
|
+
? { id, after, before, first: PAGE_SIZE }
|
|
65
|
+
: { id, after, before, last: PAGE_SIZE };
|
|
66
|
+
|
|
67
|
+
const { loading, error, data } = useQuery(
|
|
68
|
+
IMPLEMENTATION_RESULTS_CONNECTION_QUERY,
|
|
69
|
+
{
|
|
70
|
+
variables,
|
|
71
|
+
}
|
|
72
|
+
);
|
|
66
73
|
if (error) return null;
|
|
67
74
|
if (loading) return <Loading />;
|
|
68
|
-
const
|
|
75
|
+
const implementation = data?.implementation;
|
|
76
|
+
const connection = data?.implementation?.resultsConnection;
|
|
77
|
+
const results = implementation?.resultsConnection?.page;
|
|
69
78
|
return (
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
<Segment attached="bottom">
|
|
80
|
+
<RuleImplementationResults
|
|
81
|
+
implementation={implementation}
|
|
82
|
+
results={results}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
<CursorPagination {...connection} />
|
|
86
|
+
</Segment>
|
|
74
87
|
);
|
|
75
88
|
};
|
|
76
89
|
|
|
@@ -79,7 +79,10 @@ export const RuleResultRow = ({
|
|
|
79
79
|
<>
|
|
80
80
|
<Icon
|
|
81
81
|
name="circle"
|
|
82
|
-
color={selectColor({
|
|
82
|
+
color={selectColor({
|
|
83
|
+
...ruleImplementation,
|
|
84
|
+
...ruleResult,
|
|
85
|
+
})}
|
|
83
86
|
/>
|
|
84
87
|
{`${parseFloat(ruleResult.result)} %`}
|
|
85
88
|
</>
|
|
@@ -21,22 +21,14 @@ export const getCustomColumnsWithData = (ruleResults, columns) =>
|
|
|
21
21
|
_.any(_.flow(columnDecorator(column), _.negate(_.isEmpty)))(ruleResults)
|
|
22
22
|
)(columns);
|
|
23
23
|
|
|
24
|
-
export const RuleResultsTable = ({
|
|
25
|
-
columns,
|
|
26
|
-
implementationVersions,
|
|
27
|
-
currentImplementationVersion,
|
|
28
|
-
}) => {
|
|
24
|
+
export const RuleResultsTable = ({ columns, implementation, results }) => {
|
|
29
25
|
const isAdmin = useAuthorized();
|
|
30
26
|
const { formatMessage } = useIntl();
|
|
31
27
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
_.flatten
|
|
35
|
-
)(implementationVersions);
|
|
36
|
-
const optionalColumns = getOptionalColumnsWithData(ruleResults);
|
|
37
|
-
const customColumns = getCustomColumnsWithData(ruleResults, columns);
|
|
28
|
+
const optionalColumns = getOptionalColumnsWithData(results);
|
|
29
|
+
const customColumns = getCustomColumnsWithData(results, columns);
|
|
38
30
|
|
|
39
|
-
return _.isEmpty(
|
|
31
|
+
return _.isEmpty(results) ? (
|
|
40
32
|
<Message
|
|
41
33
|
style={{ marginTop: "14px" }}
|
|
42
34
|
header={formatMessage({
|
|
@@ -77,28 +69,43 @@ export const RuleResultsTable = ({
|
|
|
77
69
|
</Table.Row>
|
|
78
70
|
</Table.Header>
|
|
79
71
|
<Table.Body>
|
|
80
|
-
{
|
|
81
|
-
_.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
{_.flow(
|
|
73
|
+
_.groupBy("implementation.version"),
|
|
74
|
+
_.toPairs, // first element: version number; second element: version results.
|
|
75
|
+
// order by descending version number
|
|
76
|
+
_.orderBy(
|
|
77
|
+
(versionAndResultsTuple) => versionAndResultsTuple[0],
|
|
78
|
+
"desc"
|
|
79
|
+
),
|
|
80
|
+
_.mapValues((versionAndResultsTuple) =>
|
|
81
|
+
versionAndResultsTuple[1].map(
|
|
82
|
+
(result, indexWithinVersionGroup) => ({
|
|
83
|
+
indexWithinVersionGroup,
|
|
84
|
+
...result,
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
),
|
|
88
|
+
_.reduce((acc, versionResults) => [...acc, ...versionResults], []),
|
|
89
|
+
_.map((result) => (
|
|
85
90
|
<RuleResultRow
|
|
86
|
-
key={
|
|
91
|
+
key={result.id}
|
|
87
92
|
optionalColumns={optionalColumns}
|
|
88
93
|
ruleResult={result}
|
|
89
94
|
customColumns={customColumns}
|
|
90
|
-
ruleImplementation={
|
|
91
|
-
|
|
95
|
+
ruleImplementation={_.find(
|
|
96
|
+
(version) => version?.id === result?.implementation?.id
|
|
97
|
+
)(implementation?.versions)}
|
|
98
|
+
active={implementation.version === result.implementation.version}
|
|
92
99
|
tagLabel={
|
|
93
|
-
|
|
100
|
+
result.indexWithinVersionGroup === 0
|
|
94
101
|
? `${formatMessage({
|
|
95
102
|
id: "ruleImplementations.props.version",
|
|
96
|
-
})}: ${
|
|
103
|
+
})}: ${result.implementation.version}`
|
|
97
104
|
: null
|
|
98
105
|
}
|
|
99
106
|
/>
|
|
100
107
|
))
|
|
101
|
-
)}
|
|
108
|
+
)(results)}
|
|
102
109
|
</Table.Body>
|
|
103
110
|
</Table>
|
|
104
111
|
);
|
|
@@ -106,8 +113,8 @@ export const RuleResultsTable = ({
|
|
|
106
113
|
|
|
107
114
|
RuleResultsTable.propTypes = {
|
|
108
115
|
columns: PropTypes.array,
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
implementation: PropTypes.object,
|
|
117
|
+
results: PropTypes.array,
|
|
111
118
|
};
|
|
112
119
|
|
|
113
120
|
const mapStateToProps = (state) => ({
|
|
@@ -5,7 +5,12 @@ import { ConditionSummary } from "../ConditionSummary";
|
|
|
5
5
|
describe("<ConditionSummary />", () => {
|
|
6
6
|
const rows = [
|
|
7
7
|
{
|
|
8
|
-
structure: {
|
|
8
|
+
structure: {
|
|
9
|
+
field_type: "string",
|
|
10
|
+
name: "Mes",
|
|
11
|
+
id: 2598,
|
|
12
|
+
parent_index: 1,
|
|
13
|
+
},
|
|
9
14
|
operator: { name: "in_list", value_type: "string_list" },
|
|
10
15
|
value: [{ raw: ["4", "5", "6"] }],
|
|
11
16
|
},
|
|
@@ -14,6 +19,12 @@ describe("<ConditionSummary />", () => {
|
|
|
14
19
|
icon: "setting",
|
|
15
20
|
type: "filters",
|
|
16
21
|
rows,
|
|
22
|
+
alias: [
|
|
23
|
+
{
|
|
24
|
+
index: 1,
|
|
25
|
+
text: "foo_alias",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
17
28
|
};
|
|
18
29
|
const renderOpts = {
|
|
19
30
|
messages: {
|
|
@@ -1,78 +1,31 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
|
-
import {
|
|
5
|
-
RuleImplementationResults,
|
|
4
|
+
import RuleImplementationResults, {
|
|
6
5
|
getCustomColumnsWithData,
|
|
6
|
+
PAGE_SIZE,
|
|
7
7
|
} from "../RuleImplementationResults";
|
|
8
8
|
|
|
9
|
+
import { implementationResultsMock } from "./__fixtures__/implementationResultsMocks";
|
|
10
|
+
|
|
11
|
+
jest.mock("react-router-dom", () => ({
|
|
12
|
+
...jest.requireActual("react-router-dom"),
|
|
13
|
+
useParams: () => ({ implementation_id: "2" }),
|
|
14
|
+
}));
|
|
15
|
+
|
|
9
16
|
describe("<RuleImplementationResults />", () => {
|
|
10
|
-
const
|
|
11
|
-
id:
|
|
12
|
-
implementation_key: "default_key",
|
|
13
|
-
versions: [
|
|
14
|
-
{
|
|
15
|
-
implementation_key: "default_key",
|
|
16
|
-
id: 1,
|
|
17
|
-
goal: "20.0",
|
|
18
|
-
minimum: "10.0",
|
|
19
|
-
results: [
|
|
20
|
-
{
|
|
21
|
-
errors: 2,
|
|
22
|
-
hasRemediation: false,
|
|
23
|
-
hasSegments: true,
|
|
24
|
-
id: "66577",
|
|
25
|
-
records: 31,
|
|
26
|
-
result: "93.54",
|
|
27
|
-
resultType: "percentage",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
errors: 2,
|
|
31
|
-
hasRemediation: false,
|
|
32
|
-
hasSegments: true,
|
|
33
|
-
id: "66578",
|
|
34
|
-
records: 31,
|
|
35
|
-
result: "93.54",
|
|
36
|
-
resultType: "percentage",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
implementation_key: "key_2",
|
|
42
|
-
id: 2,
|
|
43
|
-
goal: "20.0",
|
|
44
|
-
minimum: "10.0",
|
|
45
|
-
results: [
|
|
46
|
-
{
|
|
47
|
-
errors: 2,
|
|
48
|
-
hasRemediation: false,
|
|
49
|
-
hasSegments: true,
|
|
50
|
-
id: "66579",
|
|
51
|
-
records: 31,
|
|
52
|
-
result: "93.54",
|
|
53
|
-
resultType: "percentage",
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
errors: 2,
|
|
57
|
-
hasRemediation: false,
|
|
58
|
-
hasSegments: true,
|
|
59
|
-
id: "66580",
|
|
60
|
-
records: 31,
|
|
61
|
-
result: "93.54",
|
|
62
|
-
resultType: "percentage",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
],
|
|
17
|
+
const renderOpts = {
|
|
18
|
+
mocks: [implementationResultsMock({ id: "2", last: PAGE_SIZE })],
|
|
67
19
|
};
|
|
20
|
+
|
|
68
21
|
const ruleResultsColumns = [{ foo: "bar", name: "foo" }];
|
|
69
|
-
const props = {
|
|
70
|
-
ruleImplementation,
|
|
71
|
-
ruleResultsColumns,
|
|
72
|
-
};
|
|
73
22
|
|
|
74
|
-
it("matches the latest snapshot", () => {
|
|
75
|
-
const { container } = render(
|
|
23
|
+
it("matches the latest snapshot", async () => {
|
|
24
|
+
const { container, findByRole } = render(
|
|
25
|
+
<RuleImplementationResults />,
|
|
26
|
+
renderOpts
|
|
27
|
+
);
|
|
28
|
+
expect(await findByRole("table")).toBeInTheDocument();
|
|
76
29
|
expect(container).toMatchSnapshot();
|
|
77
30
|
});
|
|
78
31
|
});
|
|
@@ -37,6 +37,10 @@ export const newRuleImplementationProps = {
|
|
|
37
37
|
ruleImplementationProps: {
|
|
38
38
|
dataset: [
|
|
39
39
|
{
|
|
40
|
+
alias: {
|
|
41
|
+
index: 1,
|
|
42
|
+
text: "FS",
|
|
43
|
+
},
|
|
40
44
|
clauses: [],
|
|
41
45
|
structure: {
|
|
42
46
|
external_id: "/data/example.txt",
|
|
@@ -53,6 +57,10 @@ export const newRuleImplementationProps = {
|
|
|
53
57
|
},
|
|
54
58
|
},
|
|
55
59
|
{
|
|
60
|
+
alias: {
|
|
61
|
+
index: 2,
|
|
62
|
+
text: "table2",
|
|
63
|
+
},
|
|
56
64
|
clauses: [
|
|
57
65
|
{
|
|
58
66
|
left: {
|
|
@@ -67,6 +75,7 @@ export const newRuleImplementationProps = {
|
|
|
67
75
|
tablename: "table2",
|
|
68
76
|
type: "string",
|
|
69
77
|
},
|
|
78
|
+
parent_index: 2,
|
|
70
79
|
name: "capital",
|
|
71
80
|
path: ["bucket", "table2"],
|
|
72
81
|
system: {
|
|
@@ -82,6 +91,7 @@ export const newRuleImplementationProps = {
|
|
|
82
91
|
metadata: {
|
|
83
92
|
metadata: { order: "8" },
|
|
84
93
|
},
|
|
94
|
+
parent_index: 1,
|
|
85
95
|
name: "external",
|
|
86
96
|
path: ["Main", "example.txt"],
|
|
87
97
|
system: {
|
|
@@ -112,6 +122,7 @@ export const newRuleImplementationProps = {
|
|
|
112
122
|
},
|
|
113
123
|
type: "Table",
|
|
114
124
|
},
|
|
125
|
+
join_type: "inner"
|
|
115
126
|
},
|
|
116
127
|
],
|
|
117
128
|
deleted_at: null,
|