@truedat/ie 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 (106) hide show
  1. package/package.json +42 -67
  2. package/src/ingests/components/EventRow.js +1 -2
  3. package/src/ingests/components/Events.js +3 -4
  4. package/src/ingests/components/FieldGroupTable.js +1 -2
  5. package/src/ingests/components/Ingest.js +1 -2
  6. package/src/ingests/components/IngestActions.js +1 -2
  7. package/src/ingests/components/IngestArchive.js +2 -3
  8. package/src/ingests/components/IngestArchiveLoader.js +16 -38
  9. package/src/ingests/components/IngestArchiveRow.js +5 -6
  10. package/src/ingests/components/IngestCompleteness.js +0 -1
  11. package/src/ingests/components/IngestCrumbs.js +2 -4
  12. package/src/ingests/components/IngestDetails.js +3 -3
  13. package/src/ingests/components/IngestDuplicate.js +5 -8
  14. package/src/ingests/components/IngestEdit.js +5 -8
  15. package/src/ingests/components/IngestExecutions.js +7 -7
  16. package/src/ingests/components/IngestExecutionsLoader.js +2 -2
  17. package/src/ingests/components/IngestFilters.js +5 -6
  18. package/src/ingests/components/IngestForm.js +4 -5
  19. package/src/ingests/components/IngestHeader.js +0 -1
  20. package/src/ingests/components/IngestLoader.js +16 -58
  21. package/src/ingests/components/IngestRoutes.js +272 -231
  22. package/src/ingests/components/IngestRow.js +4 -5
  23. package/src/ingests/components/IngestSelectedFilters.js +10 -10
  24. package/src/ingests/components/IngestSummary.js +0 -2
  25. package/src/ingests/components/IngestTabs.js +13 -13
  26. package/src/ingests/components/Ingests.js +0 -1
  27. package/src/ingests/components/IngestsActions.js +1 -2
  28. package/src/ingests/components/IngestsLabelResults.js +1 -2
  29. package/src/ingests/components/IngestsLoader.js +1 -1
  30. package/src/ingests/components/IngestsSearch.js +0 -1
  31. package/src/ingests/components/IngestsSelector.js +0 -1
  32. package/src/ingests/components/IngestsTable.js +85 -94
  33. package/src/ingests/components/IngestsTabs.js +2 -3
  34. package/src/ingests/components/__tests__/Events.spec.js +10 -10
  35. package/src/ingests/components/__tests__/Ingest.spec.js +16 -5
  36. package/src/ingests/components/__tests__/IngestActions.spec.js +7 -7
  37. package/src/ingests/components/__tests__/IngestArchive.spec.js +7 -7
  38. package/src/ingests/components/__tests__/IngestArchiveLoader.spec.js +70 -69
  39. package/src/ingests/components/__tests__/IngestArchiveRow.spec.js +10 -12
  40. package/src/ingests/components/__tests__/IngestCompleteness.spec.js +0 -1
  41. package/src/ingests/components/__tests__/IngestDetails.spec.js +10 -10
  42. package/src/ingests/components/__tests__/IngestExecutions.spec.js +7 -7
  43. package/src/ingests/components/__tests__/IngestExecutionsLoader.spec.js +38 -47
  44. package/src/ingests/components/__tests__/IngestFilters.spec.js +0 -1
  45. package/src/ingests/components/__tests__/IngestForm.spec.js +18 -40
  46. package/src/ingests/components/__tests__/IngestHeader.spec.js +9 -9
  47. package/src/ingests/components/__tests__/IngestLabelResults.spec.js +0 -1
  48. package/src/ingests/components/__tests__/IngestLoader.spec.js +70 -41
  49. package/src/ingests/components/__tests__/IngestRoutes.spec.js +176 -0
  50. package/src/ingests/components/__tests__/IngestSelectedFilters.spec.js +33 -5
  51. package/src/ingests/components/__tests__/Ingests.spec.js +32 -6
  52. package/src/ingests/components/__tests__/IngestsActions.spec.js +5 -5
  53. package/src/ingests/components/__tests__/IngestsLoader.spec.js +65 -36
  54. package/src/ingests/components/__tests__/IngestsTable.spec.js +16 -7
  55. package/src/ingests/components/__tests__/__snapshots__/Events.spec.js.snap +83 -43
  56. package/src/ingests/components/__tests__/__snapshots__/Ingest.spec.js.snap +27 -14
  57. package/src/ingests/components/__tests__/__snapshots__/IngestActions.spec.js.snap +19 -20
  58. package/src/ingests/components/__tests__/__snapshots__/IngestArchive.spec.js.snap +79 -65
  59. package/src/ingests/components/__tests__/__snapshots__/IngestArchiveLoader.spec.js.snap +1 -1
  60. package/src/ingests/components/__tests__/__snapshots__/IngestArchiveRow.spec.js.snap +30 -30
  61. package/src/ingests/components/__tests__/__snapshots__/IngestDetails.spec.js.snap +30 -13
  62. package/src/ingests/components/__tests__/__snapshots__/IngestExecutions.spec.js.snap +121 -101
  63. package/src/ingests/components/__tests__/__snapshots__/IngestExecutionsLoader.spec.js.snap +1 -1
  64. package/src/ingests/components/__tests__/__snapshots__/IngestFilters.spec.js.snap +1 -1
  65. package/src/ingests/components/__tests__/__snapshots__/IngestForm.spec.js.snap +28 -27
  66. package/src/ingests/components/__tests__/__snapshots__/IngestHeader.spec.js.snap +21 -19
  67. package/src/ingests/components/__tests__/__snapshots__/IngestLabelResults.spec.js.snap +1 -1
  68. package/src/ingests/components/__tests__/__snapshots__/IngestLoader.spec.js.snap +1 -15
  69. package/src/ingests/components/__tests__/__snapshots__/IngestRoutes.spec.js.snap +243 -0
  70. package/src/ingests/components/__tests__/__snapshots__/IngestSelectedFilters.spec.js.snap +22 -16
  71. package/src/ingests/components/__tests__/__snapshots__/Ingests.spec.js.snap +50 -33
  72. package/src/ingests/components/__tests__/__snapshots__/IngestsActions.spec.js.snap +17 -50
  73. package/src/ingests/components/__tests__/__snapshots__/IngestsLoader.spec.js.snap +1 -21
  74. package/src/ingests/components/__tests__/__snapshots__/IngestsTable.spec.js.snap +15 -24
  75. package/src/ingests/components/index.js +1 -1
  76. package/src/ingests/constants/mappings.js +6 -6
  77. package/src/ingests/relations/components/IngestLinkActions.js +0 -1
  78. package/src/ingests/relations/components/IngestLinksActions.js +1 -2
  79. package/src/ingests/relations/components/IngestRelationsRoutes.js +67 -69
  80. package/src/ingests/relations/components/IngestToDataStructureRelations.js +2 -2
  81. package/src/ingests/relations/components/IngestToIngestForm.js +4 -4
  82. package/src/ingests/relations/components/IngestToIngestRelations.js +4 -4
  83. package/src/ingests/relations/components/IngestToStructureForm.js +6 -6
  84. package/src/ingests/relations/components/__tests__/IngestRelationsRoutes.spec.js +80 -4
  85. package/src/ingests/relations/components/__tests__/IngestToIngestForm.spec.js +24 -25
  86. package/src/ingests/relations/components/__tests__/IngestToStructureForm.spec.js +42 -23
  87. package/src/ingests/relations/components/__tests__/__snapshots__/IngestRelationsRoutes.spec.js.snap +49 -23
  88. package/src/ingests/relations/components/__tests__/__snapshots__/IngestToIngestForm.spec.js.snap +85 -27
  89. package/src/ingests/relations/components/__tests__/__snapshots__/IngestToStructureForm.spec.js.snap +30 -35
  90. package/src/ingests/relations/selectors/__tests__/getIngestLinks.spec.js +20 -20
  91. package/src/ingests/relations/selectors/__tests__/getRelations.spec.js +17 -17
  92. package/src/ingests/relations/selectors/getIngestLinks.js +1 -2
  93. package/src/ingests/relations/selectors/getRelations.js +6 -6
  94. package/src/ingests/sagas/fetchIngest.js +1 -1
  95. package/src/ingests/sagas/fetchIngestArchive.js +1 -1
  96. package/src/ingests/sagas/fetchIngestExecutions.js +1 -1
  97. package/src/ingests/selectors/getIngestColumns.js +12 -13
  98. package/src/ingests/selectors/getIngestTemplate.js +1 -1
  99. package/src/ingests/selectors/getParsedEvents.js +15 -15
  100. package/src/ingests/selectors/getTemplateFields.js +3 -3
  101. package/src/ingests/selectors/getTemplateGroups.js +1 -1
  102. package/src/ingests/utils/filterOptions.js +3 -2
  103. package/src/ingests/components/__tests__/IngestDuplicate.spec.js +0 -67
  104. package/src/ingests/components/__tests__/IngestEdit.spec.js +0 -79
  105. package/src/ingests/components/__tests__/__snapshots__/IngestDuplicate.spec.js.snap +0 -85
  106. package/src/ingests/components/__tests__/__snapshots__/IngestEdit.spec.js.snap +0 -80
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import Moment from "react-moment";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
@@ -38,7 +37,6 @@ export const IngestSummary = ({
38
37
  <Header as="h3" dividing>
39
38
  <FormattedMessage id="ingests.summary" defaultMessage="Resumen" />
40
39
  </Header>
41
-
42
40
  <FieldValue
43
41
  field="status"
44
42
  value={<FormattedMessage id={`ingests.status.${status}`} />}
@@ -1,8 +1,8 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { Menu } from "semantic-ui-react";
5
- import { Link, useRouteMatch } from "react-router-dom";
4
+ import { Link } from "react-router";
5
+ import { useLocation } from "react-router";
6
6
  import { connect } from "react-redux";
7
7
  import { FormattedMessage } from "react-intl";
8
8
  import {
@@ -12,16 +12,16 @@ import {
12
12
  INGEST_EVENTS,
13
13
  INGEST_EXECUTIONS,
14
14
  INGEST_RELATIONS_STRUCTURES,
15
- INGEST_RELATIONS_INGESTS
15
+ INGEST_RELATIONS_INGESTS,
16
16
  } from "@truedat/core/routes";
17
17
  import { makeTagOptionsSelector } from "@truedat/core/selectors";
18
18
 
19
19
  const IngestTabs = ({ ingest, tagOptions }) => {
20
- const match = useRouteMatch();
20
+ const { pathname } = useLocation();
21
21
  return _.isEmpty(ingest) ? null : (
22
22
  <Menu attached="top" pointing secondary tabular>
23
23
  <Menu.Item
24
- active={match.path === INGEST}
24
+ active={pathname === INGEST}
25
25
  as={Link}
26
26
  to={linkTo.INGEST(ingest)}
27
27
  replace
@@ -29,7 +29,7 @@ const IngestTabs = ({ ingest, tagOptions }) => {
29
29
  <FormattedMessage id="tabs.ie.ingest" />
30
30
  </Menu.Item>
31
31
  <Menu.Item
32
- active={match.path === INGEST_EXECUTIONS}
32
+ active={pathname === INGEST_EXECUTIONS}
33
33
  as={Link}
34
34
  to={linkTo.INGEST_EXECUTIONS(ingest)}
35
35
  replace
@@ -37,7 +37,7 @@ const IngestTabs = ({ ingest, tagOptions }) => {
37
37
  <FormattedMessage id="tabs.ie.ingestExecutions" />
38
38
  </Menu.Item>
39
39
  <Menu.Item
40
- active={match.path === INGEST_RELATIONS_STRUCTURES}
40
+ active={pathname === INGEST_RELATIONS_STRUCTURES}
41
41
  as={Link}
42
42
  to={linkTo.INGEST_RELATIONS_STRUCTURES(ingest)}
43
43
  replace
@@ -46,7 +46,7 @@ const IngestTabs = ({ ingest, tagOptions }) => {
46
46
  </Menu.Item>
47
47
  {_.isEmpty(tagOptions) ? null : (
48
48
  <Menu.Item
49
- active={match.path === INGEST_RELATIONS_INGESTS}
49
+ active={pathname === INGEST_RELATIONS_INGESTS}
50
50
  as={Link}
51
51
  to={linkTo.INGEST_RELATIONS_INGESTS(ingest)}
52
52
  replace
@@ -55,7 +55,7 @@ const IngestTabs = ({ ingest, tagOptions }) => {
55
55
  </Menu.Item>
56
56
  )}
57
57
  <Menu.Item
58
- active={match.path === INGEST_ARCHIVE}
58
+ active={pathname === INGEST_ARCHIVE}
59
59
  as={Link}
60
60
  to={linkTo.INGEST_ARCHIVE(ingest)}
61
61
  replace
@@ -63,7 +63,7 @@ const IngestTabs = ({ ingest, tagOptions }) => {
63
63
  <FormattedMessage id="tabs.ie.history" />
64
64
  </Menu.Item>
65
65
  <Menu.Item
66
- active={match.path === INGEST_EVENTS}
66
+ active={pathname === INGEST_EVENTS}
67
67
  as={Link}
68
68
  to={linkTo.INGEST_EVENTS(ingest)}
69
69
  replace
@@ -76,14 +76,14 @@ const IngestTabs = ({ ingest, tagOptions }) => {
76
76
 
77
77
  IngestTabs.propTypes = {
78
78
  ingest: PropTypes.object,
79
- tagOptions: PropTypes.array
79
+ tagOptions: PropTypes.array,
80
80
  };
81
81
 
82
82
  const makeMapStateToProps = () => {
83
83
  const getTagOptions = makeTagOptionsSelector("ingest");
84
- const mapStateToProps = state => ({
84
+ const mapStateToProps = (state) => ({
85
85
  tagOptions: getTagOptions(state),
86
- ingest: state.ingest
86
+ ingest: state.ingest,
87
87
  });
88
88
  return mapStateToProps;
89
89
  };
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { Header, Icon, Segment } from "semantic-ui-react";
3
2
  import { FormattedMessage } from "react-intl";
4
3
 
@@ -1,9 +1,8 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
5
4
  import { Button, Popup } from "semantic-ui-react";
6
- import { Link } from "react-router-dom";
5
+ import { Link } from "react-router";
7
6
  import { FormattedMessage } from "react-intl";
8
7
  import { INGESTS_NEW } from "@truedat/core/routes";
9
8
  import { downloadIngests } from "../routines";
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { connect } from "react-redux";
4
3
  import { FormattedMessage } from "react-intl";
@@ -14,7 +13,7 @@ export const IngestsLabelResults = ({ ingestCount }) => (
14
13
  );
15
14
 
16
15
  IngestsLabelResults.propTypes = {
17
- ingestCount: PropTypes.number
16
+ ingestCount: PropTypes.number,
18
17
  };
19
18
 
20
19
  const mapStateToProps = ({ ingestCount }) => ({ ingestCount });
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useEffect } from "react";
2
+ import { useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Loading } from "@truedat/core/components";
@@ -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 { connect } from "react-redux";
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { FormattedMessage, useIntl } from "react-intl";
5
4
  import { connect } from "react-redux";
@@ -1,103 +1,104 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { compose } from "redux";
5
- import { connect } from "react-redux";
4
+ import { useDispatch, useSelector } from "react-redux";
6
5
  import { Table, Header, Icon } from "semantic-ui-react";
7
6
  import { FormattedMessage } from "react-intl";
8
- import { withRouter } from "react-router";
7
+ import { useLocation } from "react-router";
9
8
  import { getSortInfo, sortColumn } from "@truedat/core/services/sort";
10
9
  import { INGESTS, INGESTS_PENDING } from "@truedat/core/routes";
11
10
  import { sortIngests } from "../routines";
12
11
  import { getIngestsRows, getIngestColumns } from "../selectors";
13
12
  import IngestRow from "./IngestRow";
14
13
 
15
- export class IngestsTable extends React.Component {
16
- state = {
17
- sortedColumn: _.prop("column")(getSortInfo(this.props.ingestsSorting)),
18
- direction: _.prop("direction")(getSortInfo(this.props.ingestsSorting)),
19
- };
20
-
21
- setDirection = (direction) => this.setState({ direction });
14
+ export function IngestsTable() {
15
+ const dispatch = useDispatch();
16
+ const location = useLocation();
17
+ const columns = useSelector(getIngestColumns);
18
+ const ingests = useSelector(getIngestsRows);
19
+ const ingestsLoading = useSelector((state) => state.ingestsLoading);
20
+ const ingestsSorting = useSelector((state) =>
21
+ _.path("ingestQuery.sort")(state)
22
+ );
22
23
 
23
- setColumn = (sortedColumn) => this.setState({ sortedColumn });
24
+ const initialSortInfo = getSortInfo(ingestsSorting);
25
+ const [sortedColumn, setSortedColumn] = useState(
26
+ _.prop("column")(initialSortInfo)
27
+ );
28
+ const [direction, setDirection] = useState(
29
+ _.prop("direction")(initialSortInfo)
30
+ );
24
31
 
25
- componentDidUpdate(prevProps) {
26
- const { ingestsSorting: prevIngestsSorting } = prevProps;
27
- const { ingestsSorting } = this.props;
32
+ useEffect(() => {
33
+ const { column, direction } = getSortInfo(ingestsSorting);
34
+ setSortedColumn(column);
35
+ setDirection(direction);
36
+ }, [ingestsSorting]);
28
37
 
29
- if (ingestsSorting !== prevIngestsSorting) {
30
- const { column: sortedColumn, direction } = getSortInfo(ingestsSorting);
31
- this.setState({ sortedColumn, direction });
32
- }
33
- }
38
+ const pathname = _.prop("pathname")(location);
39
+ const ingestColumns = columns.filter(
40
+ (column) =>
41
+ (pathname == INGESTS && column.name != "status") ||
42
+ pathname == INGESTS_PENDING
43
+ );
34
44
 
35
- render() {
36
- const { ingests, columns, ingestsLoading, location, sortIngests } =
37
- this.props;
38
- const { sortedColumn, direction } = this.state;
39
- const pathname = _.prop("pathname")(location);
40
- const ingestColumns = columns.filter(
41
- (column) =>
42
- (pathname == INGESTS && column.name != "status") ||
43
- pathname == INGESTS_PENDING
45
+ const handleSortColumn = (column) => {
46
+ sortColumn(
47
+ column,
48
+ (payload) => dispatch(sortIngests(payload)),
49
+ setDirection,
50
+ setSortedColumn,
51
+ direction,
52
+ sortedColumn
44
53
  );
54
+ };
45
55
 
46
- return (
47
- <>
48
- {!_.isEmpty(ingests) && (
49
- <Table selectable sortable>
50
- <Table.Header>
51
- <Table.Row>
52
- {ingestColumns &&
53
- ingestColumns.map((column, key) => (
54
- <Table.HeaderCell
55
- key={key}
56
- width={column.width}
57
- content={
58
- <FormattedMessage
59
- id={`ingests.props.${column.header || column.name}`}
60
- />
61
- }
62
- sorted={
63
- _.path("sort.name")(column) === sortedColumn
64
- ? direction
65
- : null
66
- }
67
- className={_.path("sort.name")(column) ? "" : "disabled"}
68
- onClick={() =>
69
- sortColumn(
70
- column,
71
- sortIngests,
72
- this.setDirection,
73
- this.setColumn,
74
- direction,
75
- sortedColumn
76
- )
77
- }
78
- />
79
- ))}
80
- </Table.Row>
81
- </Table.Header>
82
- <Table.Body>
83
- {ingests.map((ingest, i) => (
84
- <IngestRow key={i} ingest={ingest} columns={ingestColumns} />
85
- ))}
86
- </Table.Body>
87
- </Table>
88
- )}
89
- {_.isEmpty(ingests) && !ingestsLoading && (
90
- <Header as="h4">
91
- <Icon name="search" />
92
- <Header.Content>
93
- <FormattedMessage id="ingests.search.results.empty" />
94
- </Header.Content>
95
- </Header>
96
- )}
97
- </>
98
- );
99
- }
56
+ return (
57
+ <>
58
+ {!_.isEmpty(ingests) && (
59
+ <Table selectable sortable>
60
+ <Table.Header>
61
+ <Table.Row>
62
+ {ingestColumns &&
63
+ ingestColumns.map((column, key) => (
64
+ <Table.HeaderCell
65
+ key={key}
66
+ width={column.width}
67
+ content={
68
+ <FormattedMessage
69
+ id={`ingests.props.${column.header || column.name}`}
70
+ />
71
+ }
72
+ sorted={
73
+ _.path("sort.name")(column) === sortedColumn
74
+ ? direction
75
+ : null
76
+ }
77
+ className={_.path("sort.name")(column) ? "" : "disabled"}
78
+ onClick={() => handleSortColumn(column)}
79
+ />
80
+ ))}
81
+ </Table.Row>
82
+ </Table.Header>
83
+ <Table.Body>
84
+ {ingests.map((ingest, i) => (
85
+ <IngestRow key={i} ingest={ingest} columns={ingestColumns} />
86
+ ))}
87
+ </Table.Body>
88
+ </Table>
89
+ )}
90
+ {_.isEmpty(ingests) && !ingestsLoading && (
91
+ <Header as="h4">
92
+ <Icon name="search" />
93
+ <Header.Content>
94
+ <FormattedMessage id="ingests.search.results.empty" />
95
+ </Header.Content>
96
+ </Header>
97
+ )}
98
+ </>
99
+ );
100
100
  }
101
+
101
102
  IngestsTable.propTypes = {
102
103
  ingestsLoading: PropTypes.bool,
103
104
  ingests: PropTypes.array,
@@ -105,14 +106,4 @@ IngestsTable.propTypes = {
105
106
  location: PropTypes.object,
106
107
  };
107
108
 
108
- const mapStateToProps = (state) => ({
109
- columns: getIngestColumns(state),
110
- ingests: getIngestsRows(state),
111
- ingestsLoading: state.ingestsLoading,
112
- ingestsSorting: _.path("ingestQuery.sort")(state),
113
- });
114
-
115
- export default compose(
116
- withRouter,
117
- connect(mapStateToProps, { sortIngests })
118
- )(IngestsTable);
109
+ export default IngestsTable;
@@ -1,7 +1,6 @@
1
- import React from "react";
2
1
  import { FormattedMessage } from "react-intl";
3
2
  import { connect } from "react-redux";
4
- import { Link } from "react-router-dom";
3
+ import { Link } from "react-router";
5
4
  import { Menu, Divider } from "semantic-ui-react";
6
5
  import { usePath } from "@truedat/core/hooks";
7
6
  import { INGESTS, INGESTS_PENDING } from "@truedat/core/routes";
@@ -31,7 +30,7 @@ const IngestTabs = () => {
31
30
  IngestTabs.propTypes = {};
32
31
 
33
32
  const mapStateToProps = ({ ingestQuery: { filters } }) => ({
34
- activeFilters: filters
33
+ activeFilters: filters,
35
34
  });
36
35
 
37
36
  export default connect(mapStateToProps)(IngestTabs);
@@ -1,9 +1,8 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { Events } from "../Events";
4
3
 
5
4
  describe("<Events />", () => {
6
- it("matches the latest snapshot", () => {
5
+ it("matches the latest snapshot", async () => {
7
6
  const events = [
8
7
  {
9
8
  id: 1,
@@ -11,8 +10,8 @@ describe("<Events />", () => {
11
10
  resource_id: 2,
12
11
  payload: [
13
12
  { field: "Ou", value: 5 },
14
- { field: "id", value: 6 }
15
- ]
13
+ { field: "id", value: 6 },
14
+ ],
16
15
  },
17
16
  {
18
17
  id: 2,
@@ -20,12 +19,13 @@ describe("<Events />", () => {
20
19
  resource_id: 2,
21
20
  payload: [
22
21
  { field: "Ou", value: 7 },
23
- { field: "id", value: 3 }
24
- ]
25
- }
22
+ { field: "id", value: 3 },
23
+ ],
24
+ },
26
25
  ];
27
26
  const props = { events };
28
- const wrapper = shallow(<Events {...props} />);
29
- expect(wrapper).toMatchSnapshot();
27
+ const rendered = render(<Events {...props} />);
28
+ await waitForLoad(rendered);
29
+ expect(rendered.container).toMatchSnapshot();
30
30
  });
31
31
  });
@@ -1,12 +1,23 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { Ingest } from "../Ingest";
4
3
 
4
+ // Mock the components used in Ingest
5
+ jest.mock("../IngestActions", () => () => (
6
+ <div data-testid="ingest-actions">IngestActions Mock</div>
7
+ ));
8
+ jest.mock("../IngestHeader", () => () => (
9
+ <div data-testid="ingest-header">IngestHeader Mock</div>
10
+ ));
11
+ jest.mock("../IngestTabs", () => () => (
12
+ <div data-testid="ingest-tabs">IngestTabs Mock</div>
13
+ ));
14
+
5
15
  describe("<Ingest />", () => {
6
16
  const props = { ingest: { id: 1, name: "foo" } };
7
17
 
8
- it("matches the latest snapshot", () => {
9
- const wrapper = shallow(<Ingest {...props} />);
10
- expect(wrapper).toMatchSnapshot();
18
+ it("matches the latest snapshot", async () => {
19
+ const rendered = render(<Ingest {...props} />);
20
+ await waitForLoad(rendered);
21
+ expect(rendered.container).toMatchSnapshot();
11
22
  });
12
23
  });
@@ -1,21 +1,21 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestActions } from "../IngestActions";
4
3
 
5
4
  describe("<IngestActions />", () => {
6
5
  const ingestAction = jest.fn();
7
6
  const ingestActions = {
8
7
  action1: { method: "POST", href: "/api/action1" },
9
- action2: { method: "GET", href: "/api/action2" }
8
+ action2: { method: "GET", href: "/api/action2" },
10
9
  };
11
10
 
12
11
  const props = {
13
12
  ingestAction,
14
- ingestActions
13
+ ingestActions,
15
14
  };
16
15
 
17
- it("matches the latest snapshot", () => {
18
- const wrapper = shallow(<IngestActions {...props} />);
19
- expect(wrapper).toMatchSnapshot();
16
+ it("matches the latest snapshot", async () => {
17
+ const rendered = render(<IngestActions {...props} />);
18
+ await waitForLoad(rendered);
19
+ expect(rendered.container).toMatchSnapshot();
20
20
  });
21
21
  });
@@ -1,20 +1,20 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestArchive } from "../IngestArchive";
4
3
 
5
4
  describe("<IngestArchive />", () => {
6
- it("matches the latest snapshot", () => {
5
+ it("matches the latest snapshot", async () => {
7
6
  const ingestArchive = [
8
7
  {
9
8
  id: 123,
10
9
  status: "status",
11
10
  last_change_at: "2018-06-27T07:32:53.154377Z",
12
11
  last_change_by: "maixu",
13
- version: 1
14
- }
12
+ version: 1,
13
+ },
15
14
  ];
16
15
  const props = { ingestArchive };
17
- const wrapper = shallow(<IngestArchive {...props} />);
18
- expect(wrapper).toMatchSnapshot();
16
+ const rendered = render(<IngestArchive {...props} />);
17
+ await waitForLoad(rendered);
18
+ expect(rendered.container).toMatchSnapshot();
19
19
  });
20
20
  });