@truedat/dq 4.53.9 → 4.53.11
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 +7 -1
- package/package.json +6 -6
- package/src/api/queries.js +76 -16
- package/src/components/ConceptRules.js +1 -1
- package/src/components/ConditionSummary.js +1 -1
- package/src/components/ExecutionGroups.js +4 -50
- package/src/components/ImplementationExecutionFilters.js +79 -0
- package/src/components/ImplementationExecutions.js +125 -0
- package/src/components/ImplementationStructureDelete.js +2 -6
- package/src/components/ImplementationsRoutes.js +18 -1
- package/src/components/ImplementationsUploadButton.js +1 -1
- package/src/components/RuleImplementationHistory.js +5 -8
- package/src/components/RuleImplementationHistoryRow.js +23 -28
- package/src/components/RuleImplementationResultTabs.js +2 -2
- package/src/components/RuleImplementationResults.js +24 -149
- package/src/components/RuleImplementationSelectedFilters.js +2 -1
- package/src/components/RuleImplementationTabs.js +14 -8
- package/src/components/RuleImplementationsTable.js +1 -4
- package/src/components/RuleResultDecorator.js +10 -9
- package/src/components/RuleResultRow.js +9 -15
- package/src/components/RuleResultsRoutes.js +2 -2
- package/src/components/RuleResultsTable.js +117 -0
- package/src/components/RuleResultsUpload.js +2 -6
- package/src/components/RulesUploadButton.js +1 -1
- package/src/components/__tests__/ImplementationExecutionFilters.spec.js +24 -0
- package/src/components/__tests__/ImplementationExecutions.spec.js +32 -0
- package/src/components/__tests__/RuleImplementationResults.spec.js +16 -45
- package/src/components/__tests__/RuleImplementationTabs.spec.js +1 -18
- package/src/components/__tests__/RuleResultDecorator.spec.js +12 -32
- package/src/components/__tests__/RuleResultDetails.spec.js +3 -3
- package/src/components/__tests__/RuleResultRemediations.spec.js +3 -3
- package/src/components/__tests__/RuleResultRoutes.spec.js +5 -5
- package/src/components/__tests__/RuleResultRow.spec.js +86 -82
- package/src/components/__tests__/RuleResultSegmentRow.spec.js +6 -6
- package/src/components/__tests__/RuleResultSegments.spec.js +1 -1
- package/src/components/__tests__/__fixtures__/executionMocks.js +80 -0
- package/src/components/__tests__/__snapshots__/ExecutionGroups.spec.js.snap +0 -1
- package/src/components/__tests__/__snapshots__/ImplementationExecutionFilters.spec.js.snap +37 -0
- package/src/components/__tests__/__snapshots__/ImplementationExecutions.spec.js.snap +194 -0
- package/src/components/__tests__/__snapshots__/RuleImplementation.spec.js.snap +6 -0
- package/src/components/__tests__/__snapshots__/RuleImplementationHistory.spec.js.snap +12 -24
- package/src/components/__tests__/__snapshots__/RuleImplementationResults.spec.js.snap +8 -8
- package/src/components/__tests__/__snapshots__/RuleImplementationTabs.spec.js.snap +12 -6
- package/src/components/__tests__/__snapshots__/RuleResultDecorator.spec.js.snap +4 -4
- package/src/components/ruleImplementationForm/DateField.js +2 -2
- package/src/components/ruleImplementationForm/DateTimeField.js +2 -2
- package/src/components/ruleImplementationForm/FieldModifier.js +1 -1
- package/src/components/ruleImplementationForm/FiltersFormGroup.js +3 -3
- package/src/components/ruleImplementationForm/FiltersGroup.js +2 -2
- package/src/components/ruleImplementationForm/LimitsForm.js +6 -6
- package/src/components/ruleImplementationForm/ValueConditions.js +1 -1
- package/src/functions/selectors.js +12 -4
- package/src/messages/en.js +6 -0
- package/src/messages/es.js +6 -0
- package/src/selectors/getRuleImplementationColumns.js +4 -2
- package/src/selectors/index.js +1 -1
- package/src/selectors/{getRuleResultsColumns.js → ruleResultsColumnsSelector.js} +1 -1
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
|
-
import { intl } from "@truedat/test/intl-stub";
|
|
5
4
|
import {
|
|
6
5
|
RuleImplementationResults,
|
|
7
6
|
getCustomColumnsWithData,
|
|
8
7
|
} from "../RuleImplementationResults";
|
|
9
8
|
|
|
10
|
-
const renderOpts = {
|
|
11
|
-
messages: {
|
|
12
|
-
en: {
|
|
13
|
-
"ruleResult.props.date": "date",
|
|
14
|
-
"ruleResult.props.quality": "quality",
|
|
15
|
-
"ruleResult.props.records": "records",
|
|
16
|
-
"ruleResult.props.errors": "errors",
|
|
17
|
-
"quality.error": "errors",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// workaround for enzyme issue with React.useContext
|
|
23
|
-
// see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
|
|
24
|
-
jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
25
|
-
|
|
26
9
|
describe("<RuleImplementationResults />", () => {
|
|
27
10
|
const ruleImplementation = {
|
|
28
11
|
id: 1,
|
|
@@ -36,21 +19,21 @@ describe("<RuleImplementationResults />", () => {
|
|
|
36
19
|
results: [
|
|
37
20
|
{
|
|
38
21
|
errors: 2,
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
hasRemediation: false,
|
|
23
|
+
hasSegments: true,
|
|
41
24
|
id: "66577",
|
|
42
25
|
records: 31,
|
|
43
26
|
result: "93.54",
|
|
44
|
-
|
|
27
|
+
resultType: "percentage",
|
|
45
28
|
},
|
|
46
29
|
{
|
|
47
30
|
errors: 2,
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
hasRemediation: false,
|
|
32
|
+
hasSegments: true,
|
|
50
33
|
id: "66578",
|
|
51
34
|
records: 31,
|
|
52
35
|
result: "93.54",
|
|
53
|
-
|
|
36
|
+
resultType: "percentage",
|
|
54
37
|
},
|
|
55
38
|
],
|
|
56
39
|
},
|
|
@@ -62,21 +45,21 @@ describe("<RuleImplementationResults />", () => {
|
|
|
62
45
|
results: [
|
|
63
46
|
{
|
|
64
47
|
errors: 2,
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
hasRemediation: false,
|
|
49
|
+
hasSegments: true,
|
|
67
50
|
id: "66579",
|
|
68
51
|
records: 31,
|
|
69
52
|
result: "93.54",
|
|
70
|
-
|
|
53
|
+
resultType: "percentage",
|
|
71
54
|
},
|
|
72
55
|
{
|
|
73
56
|
errors: 2,
|
|
74
|
-
|
|
75
|
-
|
|
57
|
+
hasRemediation: false,
|
|
58
|
+
hasSegments: true,
|
|
76
59
|
id: "66580",
|
|
77
60
|
records: 31,
|
|
78
61
|
result: "93.54",
|
|
79
|
-
|
|
62
|
+
resultType: "percentage",
|
|
80
63
|
},
|
|
81
64
|
],
|
|
82
65
|
},
|
|
@@ -89,10 +72,7 @@ describe("<RuleImplementationResults />", () => {
|
|
|
89
72
|
};
|
|
90
73
|
|
|
91
74
|
it("matches the latest snapshot", () => {
|
|
92
|
-
const { container } = render(
|
|
93
|
-
<RuleImplementationResults {...props} />,
|
|
94
|
-
renderOpts
|
|
95
|
-
);
|
|
75
|
+
const { container } = render(<RuleImplementationResults {...props} />);
|
|
96
76
|
expect(container).toMatchSnapshot();
|
|
97
77
|
});
|
|
98
78
|
});
|
|
@@ -105,18 +85,9 @@ describe("getCustomColumnsWithData", () => {
|
|
|
105
85
|
{ result: 20, params: { p1: "2" } },
|
|
106
86
|
];
|
|
107
87
|
const customColumns = [
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "p2",
|
|
114
|
-
fieldSelector: _.path("params.p2"),
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "p3",
|
|
118
|
-
fieldSelector: _.path("params.p3"),
|
|
119
|
-
},
|
|
88
|
+
{ name: "p1", fieldSelector: _.path("params.p1") },
|
|
89
|
+
{ name: "p2", fieldSelector: _.path("params.p2") },
|
|
90
|
+
{ name: "p3", fieldSelector: _.path("params.p3") },
|
|
120
91
|
];
|
|
121
92
|
|
|
122
93
|
const filteredColumns = getCustomColumnsWithData(
|
|
@@ -3,20 +3,6 @@ import { render } from "@truedat/test/render";
|
|
|
3
3
|
import { RuleImplementationTabs } from "../RuleImplementationTabs";
|
|
4
4
|
|
|
5
5
|
describe("<RuleImplementationTabs />", () => {
|
|
6
|
-
const renderOpts = {
|
|
7
|
-
messages: {
|
|
8
|
-
en: {
|
|
9
|
-
"tabs.dq.ruleImplementation": "ruleImplementation",
|
|
10
|
-
"tabs.dq.implementation.links.concepts": "concepts",
|
|
11
|
-
"tabs.dq.implementation.structures": "structures",
|
|
12
|
-
"tabs.dq.ruleImplementation.results": "results",
|
|
13
|
-
"tabs.dq.ruleImplementation.details": "details",
|
|
14
|
-
"tabs.dq.ruleImplementation.audit": "audit",
|
|
15
|
-
"tabs.dq.ruleImplementation.history": "history",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
6
|
const props = {
|
|
21
7
|
rule: { id: 8 },
|
|
22
8
|
ruleImplementation: { id: 1 },
|
|
@@ -24,10 +10,7 @@ describe("<RuleImplementationTabs />", () => {
|
|
|
24
10
|
canCreateLink: true,
|
|
25
11
|
};
|
|
26
12
|
it("matches the latest snapshot", () => {
|
|
27
|
-
const { container } = render(
|
|
28
|
-
<RuleImplementationTabs {...props} />,
|
|
29
|
-
renderOpts
|
|
30
|
-
);
|
|
13
|
+
const { container } = render(<RuleImplementationTabs {...props} />);
|
|
31
14
|
expect(container).toMatchSnapshot();
|
|
32
15
|
});
|
|
33
16
|
});
|
|
@@ -7,64 +7,44 @@ describe("<RuleResultDecorator />", () => {
|
|
|
7
7
|
ruleResult: {
|
|
8
8
|
result: 42,
|
|
9
9
|
errors: 1234,
|
|
10
|
-
result_text: "
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
const renderOpts = {
|
|
14
|
-
messages: {
|
|
15
|
-
en: {
|
|
16
|
-
result_text: "result_message",
|
|
17
|
-
no_data: "no_data_message",
|
|
18
|
-
"quality.result.percentage.description": "{result}%",
|
|
19
|
-
"quality.result.errors_number.description": "{result} errors",
|
|
20
|
-
"quality.result.no.data": "No data",
|
|
21
|
-
},
|
|
10
|
+
result_text: "Something happened",
|
|
22
11
|
},
|
|
23
12
|
};
|
|
24
13
|
|
|
25
14
|
it("decorates a percentage result", () => {
|
|
26
|
-
const ruleImplementation = {
|
|
15
|
+
const ruleImplementation = { resultType: "percentage" };
|
|
27
16
|
const { container, queryByTitle } = render(
|
|
28
|
-
<RuleResultDecorator
|
|
29
|
-
ruleImplementation={ruleImplementation}
|
|
30
|
-
{...props}
|
|
31
|
-
/>,
|
|
32
|
-
renderOpts
|
|
17
|
+
<RuleResultDecorator ruleImplementation={ruleImplementation} {...props} />
|
|
33
18
|
);
|
|
34
19
|
expect(container).toMatchSnapshot();
|
|
35
20
|
expect(container).toHaveTextContent("42%");
|
|
36
|
-
expect(queryByTitle("
|
|
21
|
+
expect(queryByTitle("Something happened")).toBeInTheDocument();
|
|
37
22
|
});
|
|
38
23
|
|
|
39
24
|
it("decorates an error count result", () => {
|
|
40
|
-
const ruleImplementation = {
|
|
25
|
+
const ruleImplementation = { resultType: "errors_number" };
|
|
41
26
|
const { container, queryByTitle } = render(
|
|
42
|
-
<RuleResultDecorator
|
|
43
|
-
ruleImplementation={ruleImplementation}
|
|
44
|
-
{...props}
|
|
45
|
-
/>,
|
|
46
|
-
renderOpts
|
|
27
|
+
<RuleResultDecorator ruleImplementation={ruleImplementation} {...props} />
|
|
47
28
|
);
|
|
48
29
|
expect(container).toMatchSnapshot();
|
|
49
30
|
expect(container).toHaveTextContent("1,234 errors");
|
|
50
|
-
expect(queryByTitle("
|
|
31
|
+
expect(queryByTitle("Something happened")).toBeInTheDocument();
|
|
51
32
|
});
|
|
52
33
|
|
|
53
34
|
it("decorates an implementation without result data", () => {
|
|
54
|
-
const ruleImplementation = {
|
|
35
|
+
const ruleImplementation = { resultType: "errors_number" };
|
|
55
36
|
const ruleResult = { result_text: "no_data" };
|
|
56
37
|
const props = { ruleImplementation, ruleResult };
|
|
57
38
|
const { container, queryByTitle } = render(
|
|
58
|
-
<RuleResultDecorator {...props}
|
|
59
|
-
renderOpts
|
|
39
|
+
<RuleResultDecorator {...props} />
|
|
60
40
|
);
|
|
61
41
|
expect(container).toMatchSnapshot();
|
|
62
|
-
expect(container).toHaveTextContent("No
|
|
63
|
-
expect(queryByTitle("
|
|
42
|
+
expect(container).toHaveTextContent("No information about quality");
|
|
43
|
+
expect(queryByTitle("no_data")).toBeInTheDocument();
|
|
64
44
|
});
|
|
65
45
|
|
|
66
46
|
it("handles missing execution result", () => {
|
|
67
|
-
const { container } = render(<RuleResultDecorator
|
|
47
|
+
const { container } = render(<RuleResultDecorator />);
|
|
68
48
|
expect(container).toBeEmptyDOMElement();
|
|
69
49
|
});
|
|
70
50
|
});
|
|
@@ -25,7 +25,7 @@ const commonProps = {
|
|
|
25
25
|
implementation_key: "key",
|
|
26
26
|
minimum: 10,
|
|
27
27
|
goal: 20,
|
|
28
|
-
|
|
28
|
+
resultType: "percentage",
|
|
29
29
|
},
|
|
30
30
|
ruleResult: {
|
|
31
31
|
id: 100,
|
|
@@ -35,8 +35,8 @@ const commonProps = {
|
|
|
35
35
|
records: 31,
|
|
36
36
|
date: "2022-06-24",
|
|
37
37
|
errors: 2,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
hasRemediation: true,
|
|
39
|
+
hasSegments: true,
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -23,7 +23,7 @@ describe("<RuleResultRemediations />", () => {
|
|
|
23
23
|
id: 852,
|
|
24
24
|
minimum: 1,
|
|
25
25
|
goal: 10,
|
|
26
|
-
|
|
26
|
+
resultType: "percentage",
|
|
27
27
|
},
|
|
28
28
|
ruleResult: {
|
|
29
29
|
id: 65599,
|
|
@@ -33,8 +33,8 @@ describe("<RuleResultRemediations />", () => {
|
|
|
33
33
|
records: 31,
|
|
34
34
|
date: "2022-06-24",
|
|
35
35
|
errors: 2,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
hasRemediation: true,
|
|
37
|
+
hasSegments: true,
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
IMPLEMENTATION_RESULT_SEGMENTS_RESULTS,
|
|
6
6
|
IMPLEMENTATION_RESULT_REMEDIATION_PLAN,
|
|
7
7
|
} from "@truedat/core/routes";
|
|
8
|
-
import {
|
|
8
|
+
import { IMPLEMENTATION_RESULT_QUERY } from "../../api/queries";
|
|
9
9
|
import { RuleResultsRoutes } from "../RuleResultsRoutes";
|
|
10
10
|
|
|
11
11
|
jest.mock("react-router-dom", () => ({
|
|
@@ -18,19 +18,19 @@ describe("<RuleResultsRoutes>", () => {
|
|
|
18
18
|
implementationResult: {
|
|
19
19
|
date: "2022-06-24",
|
|
20
20
|
errors: 2,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
hasRemediation: true,
|
|
22
|
+
hasSegments: true,
|
|
23
23
|
id: 1,
|
|
24
24
|
records: 31,
|
|
25
25
|
details: {},
|
|
26
26
|
result: "93.54",
|
|
27
27
|
params: {},
|
|
28
|
-
|
|
28
|
+
resultType: "percentage",
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const mock = {
|
|
33
|
-
request: { query:
|
|
33
|
+
request: { query: IMPLEMENTATION_RESULT_QUERY, variables: { id: 1 } },
|
|
34
34
|
result: { data: implementationResult },
|
|
35
35
|
};
|
|
36
36
|
const key = "mi implementación molona";
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useAuthorized } from "@truedat/core/hooks";
|
|
4
|
+
import { render } from "@truedat/test/render";
|
|
5
5
|
import { RuleResultRow } from "../RuleResultRow";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
jest.mock("@truedat/core/hooks");
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
useAuthorized.mockImplementation(() => true);
|
|
11
|
+
});
|
|
10
12
|
|
|
11
13
|
describe("<RuleResultRow />", () => {
|
|
12
14
|
it("renders customColumns values when passed", () => {
|
|
13
|
-
const
|
|
15
|
+
const props = {
|
|
14
16
|
rule: { id: 10 },
|
|
15
17
|
ruleResult: {
|
|
16
18
|
id: 54,
|
|
@@ -18,47 +20,33 @@ describe("<RuleResultRow />", () => {
|
|
|
18
20
|
params: { p1: "1", p2: "2", p3: "no" },
|
|
19
21
|
},
|
|
20
22
|
customColumns: [
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
fieldSelector: _.path("params.p1"),
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "m_parm2",
|
|
27
|
-
fieldSelector: _.path("params.p2"),
|
|
28
|
-
},
|
|
23
|
+
{ name: "m_parm1", fieldSelector: _.path("params.p1") },
|
|
24
|
+
{ name: "m_parm2", fieldSelector: _.path("params.p2") },
|
|
29
25
|
],
|
|
30
26
|
date: "2019-08-12T02:00:00Z",
|
|
31
27
|
ruleImplementation: {
|
|
32
28
|
id: 23,
|
|
33
29
|
minimum: 1,
|
|
34
30
|
goal: 10,
|
|
35
|
-
|
|
31
|
+
resultType: "percentage",
|
|
36
32
|
},
|
|
37
33
|
};
|
|
38
34
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
expect(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.find("TableRow")
|
|
51
|
-
.find("TableCell")
|
|
52
|
-
.at(3)
|
|
53
|
-
.props().children;
|
|
54
|
-
|
|
55
|
-
expect(customColumn2).toBe("2");
|
|
56
|
-
|
|
57
|
-
expect(wrapper.find("TableRow").find("TableCell")).toHaveLength(4);
|
|
35
|
+
const { queryByText, getAllByRole } = render(
|
|
36
|
+
<table>
|
|
37
|
+
<tbody>
|
|
38
|
+
<RuleResultRow {...props} />
|
|
39
|
+
</tbody>
|
|
40
|
+
</table>
|
|
41
|
+
);
|
|
42
|
+
expect(queryByText("1")).toBeInTheDocument();
|
|
43
|
+
expect(queryByText("2")).toBeInTheDocument();
|
|
44
|
+
expect(getAllByRole("row")).toHaveLength(1);
|
|
45
|
+
expect(getAllByRole("cell")).toHaveLength(5);
|
|
58
46
|
});
|
|
59
47
|
|
|
60
48
|
it("green icon when result is over goal", () => {
|
|
61
|
-
const
|
|
49
|
+
const props = {
|
|
62
50
|
rule: { id: 10 },
|
|
63
51
|
ruleResult: { id: 54, result: 80 },
|
|
64
52
|
date: "2019-08-12T02:00:00Z",
|
|
@@ -66,22 +54,24 @@ describe("<RuleResultRow />", () => {
|
|
|
66
54
|
id: 23,
|
|
67
55
|
minimum: 1,
|
|
68
56
|
goal: 10,
|
|
69
|
-
|
|
57
|
+
resultType: "percentage",
|
|
70
58
|
},
|
|
71
59
|
};
|
|
72
60
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
expect(
|
|
61
|
+
const { container } = render(
|
|
62
|
+
<table>
|
|
63
|
+
<tbody>
|
|
64
|
+
<RuleResultRow {...props} />
|
|
65
|
+
</tbody>
|
|
66
|
+
</table>
|
|
67
|
+
);
|
|
68
|
+
expect(
|
|
69
|
+
container.querySelector("td > i.green.circle.icon")
|
|
70
|
+
).toBeInTheDocument();
|
|
81
71
|
});
|
|
82
72
|
|
|
83
73
|
it("red icon when result is under minimum", () => {
|
|
84
|
-
const
|
|
74
|
+
const props = {
|
|
85
75
|
rule: { id: 10 },
|
|
86
76
|
ruleResult: { id: 54, result: 80 },
|
|
87
77
|
date: "2019-08-12T02:00:00Z",
|
|
@@ -89,82 +79,96 @@ describe("<RuleResultRow />", () => {
|
|
|
89
79
|
id: 23,
|
|
90
80
|
minimum: 81,
|
|
91
81
|
goal: 90,
|
|
92
|
-
|
|
82
|
+
resultType: "percentage",
|
|
93
83
|
},
|
|
94
84
|
};
|
|
95
85
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
expect(
|
|
86
|
+
const { container } = render(
|
|
87
|
+
<table>
|
|
88
|
+
<tbody>
|
|
89
|
+
<RuleResultRow {...props} />
|
|
90
|
+
</tbody>
|
|
91
|
+
</table>
|
|
92
|
+
);
|
|
93
|
+
expect(
|
|
94
|
+
container.querySelector("td > i.red.circle.icon")
|
|
95
|
+
).toBeInTheDocument();
|
|
104
96
|
});
|
|
105
97
|
|
|
106
98
|
it("yellow icon when result is between minimum and goal", () => {
|
|
107
|
-
const
|
|
99
|
+
const props = {
|
|
108
100
|
rule: { id: 10 },
|
|
109
101
|
ruleImplementation: {
|
|
110
102
|
id: 23,
|
|
111
103
|
minimum: 81,
|
|
112
104
|
goal: 90,
|
|
113
|
-
|
|
105
|
+
resultType: "percentage",
|
|
114
106
|
},
|
|
115
107
|
ruleResult: { id: 54, result: 82 },
|
|
116
108
|
date: "2019-08-12T02:00:00Z",
|
|
117
109
|
};
|
|
118
110
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
expect(
|
|
111
|
+
const { container } = render(
|
|
112
|
+
<table>
|
|
113
|
+
<tbody>
|
|
114
|
+
<RuleResultRow {...props} />
|
|
115
|
+
</tbody>
|
|
116
|
+
</table>
|
|
117
|
+
);
|
|
118
|
+
expect(
|
|
119
|
+
container.querySelector("td > i.yellow.circle.icon")
|
|
120
|
+
).toBeInTheDocument();
|
|
127
121
|
});
|
|
128
122
|
|
|
129
|
-
it("renders delete cell in RuleResultRow when user
|
|
130
|
-
const
|
|
123
|
+
it("renders delete cell in RuleResultRow when user is admin", () => {
|
|
124
|
+
const props = {
|
|
131
125
|
rule: { id: 10 },
|
|
132
126
|
ruleImplementation: {
|
|
133
127
|
id: 23,
|
|
134
128
|
minimum: 81,
|
|
135
129
|
goal: 90,
|
|
136
|
-
|
|
130
|
+
resultType: "percentage",
|
|
137
131
|
},
|
|
138
132
|
ruleResult: { id: 54, result: 82 },
|
|
139
133
|
date: "2019-08-12T02:00:00Z",
|
|
140
|
-
isAdmin: true,
|
|
141
134
|
deleteRuleResult: jest.fn(),
|
|
142
135
|
};
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
136
|
+
const { container } = render(
|
|
137
|
+
<table>
|
|
138
|
+
<tbody>
|
|
139
|
+
<RuleResultRow {...props} />
|
|
140
|
+
</tbody>
|
|
141
|
+
</table>
|
|
142
|
+
);
|
|
143
|
+
expect(
|
|
144
|
+
container.querySelector("td > i.red.trash.alternate.outline.icon")
|
|
145
|
+
).toBeInTheDocument();
|
|
150
146
|
});
|
|
151
147
|
|
|
152
|
-
it("does not render delete cell in RuleResultRow when user
|
|
153
|
-
|
|
148
|
+
it("does not render delete cell in RuleResultRow when user is not admin", () => {
|
|
149
|
+
useAuthorized.mockImplementation(() => false);
|
|
150
|
+
|
|
151
|
+
const props = {
|
|
154
152
|
rule: { id: 10 },
|
|
155
153
|
ruleImplementation: {
|
|
156
154
|
id: 23,
|
|
157
155
|
minimum: 81,
|
|
158
156
|
goal: 90,
|
|
159
|
-
|
|
157
|
+
resultType: "percentage",
|
|
160
158
|
},
|
|
161
159
|
ruleResult: { id: 54, result: 82 },
|
|
162
160
|
date: "2019-08-12T02:00:00Z",
|
|
163
|
-
isAdmin: false,
|
|
164
161
|
deleteRuleResult: jest.fn(),
|
|
165
162
|
};
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
const { container } = render(
|
|
164
|
+
<table>
|
|
165
|
+
<tbody>
|
|
166
|
+
<RuleResultRow {...props} />
|
|
167
|
+
</tbody>
|
|
168
|
+
</table>
|
|
169
|
+
);
|
|
170
|
+
expect(
|
|
171
|
+
container.querySelector("td > i.red.trash.alternate.outline.icon")
|
|
172
|
+
).not.toBeInTheDocument();
|
|
169
173
|
});
|
|
170
174
|
});
|
|
@@ -32,7 +32,7 @@ describe("<RuleResultSegmentRow />", () => {
|
|
|
32
32
|
id: 23,
|
|
33
33
|
minimum: 1,
|
|
34
34
|
goal: 10,
|
|
35
|
-
|
|
35
|
+
resultType: "percentage",
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -69,7 +69,7 @@ describe("<RuleResultSegmentRow />", () => {
|
|
|
69
69
|
id: 23,
|
|
70
70
|
minimum: 1,
|
|
71
71
|
goal: 10,
|
|
72
|
-
|
|
72
|
+
resultType: "percentage",
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
|
|
@@ -94,7 +94,7 @@ describe("<RuleResultSegmentRow />", () => {
|
|
|
94
94
|
id: 23,
|
|
95
95
|
minimum: 81,
|
|
96
96
|
goal: 90,
|
|
97
|
-
|
|
97
|
+
resultType: "percentage",
|
|
98
98
|
},
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -117,7 +117,7 @@ describe("<RuleResultSegmentRow />", () => {
|
|
|
117
117
|
id: 23,
|
|
118
118
|
minimum: 81,
|
|
119
119
|
goal: 90,
|
|
120
|
-
|
|
120
|
+
resultType: "percentage",
|
|
121
121
|
},
|
|
122
122
|
segmentResult: { id: 54, result: 82, params: { segment_name: "foo" } },
|
|
123
123
|
date: "2019-08-12T02:00:00Z",
|
|
@@ -142,7 +142,7 @@ describe("<RuleResultSegmentRow />", () => {
|
|
|
142
142
|
id: 23,
|
|
143
143
|
minimum: 81,
|
|
144
144
|
goal: 90,
|
|
145
|
-
|
|
145
|
+
resultType: "percentage",
|
|
146
146
|
},
|
|
147
147
|
segmentResult: { id: 54, result: 82, params: { segment_name: "foo" } },
|
|
148
148
|
date: "2019-08-12T02:00:00Z",
|
|
@@ -167,7 +167,7 @@ describe("<RuleResultSegmentRow />", () => {
|
|
|
167
167
|
id: 23,
|
|
168
168
|
minimum: 81,
|
|
169
169
|
goal: 90,
|
|
170
|
-
|
|
170
|
+
resultType: "percentage",
|
|
171
171
|
},
|
|
172
172
|
segmentResult: { id: 54, result: 82, params: { segment_name: "foo" } },
|
|
173
173
|
date: "2019-08-12T02:00:00Z",
|