@truedat/ie 7.5.7 → 7.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -2,56 +2,23 @@
2
2
 
3
3
  exports[`<IngestsActions /> matches the latest snapshot 1`] = `
4
4
  <div>
5
- <Button
6
- as={
7
- {
8
- "$$typeof": Symbol(react.forward_ref),
9
- "displayName": "Link",
10
- "propTypes": {
11
- "innerRef": [Function],
12
- "onClick": [Function],
13
- "replace": [Function],
14
- "target": [Function],
15
- "to": [Function],
16
- },
17
- "render": [Function],
18
- }
19
- }
20
- content={
21
- <Memo(MemoizedFormattedMessage)
22
- id="ingests.actions.create"
5
+ <div>
6
+ <a
7
+ class="ui primary right floated button"
8
+ data-discover="true"
9
+ href="/url/to/create/ingest"
10
+ role="button"
11
+ >
12
+ ingests.actions.create
13
+ </a>
14
+ <button
15
+ class="ui icon secondary right floated button"
16
+ >
17
+ <i
18
+ aria-hidden="true"
19
+ class="download icon"
23
20
  />
24
- }
25
- floated="right"
26
- primary={true}
27
- to="/url/to/create/ingest"
28
- />
29
- <Popup
30
- content={
31
- <Memo(MemoizedFormattedMessage)
32
- id="ingests.actions.download.tooltip"
33
- />
34
- }
35
- disabled={false}
36
- eventsEnabled={true}
37
- on={
38
- [
39
- "click",
40
- "hover",
41
- ]
42
- }
43
- pinned={false}
44
- popperModifiers={[]}
45
- position="top left"
46
- trigger={
47
- <Button
48
- as="button"
49
- floated="right"
50
- icon="download"
51
- onClick={[Function]}
52
- secondary={true}
53
- />
54
- }
55
- />
21
+ </button>
22
+ </div>
56
23
  </div>
57
24
  `;
@@ -1,23 +1,3 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`<IngestsLoader /> matches the latest snapshot 1`] = `
4
- <IngestsLoader
5
- clearIngests={[MockFunction]}
6
- fetchIngests={
7
- [MockFunction] {
8
- "calls": [
9
- [
10
- undefined,
11
- ],
12
- ],
13
- "results": [
14
- {
15
- "type": "return",
16
- "value": undefined,
17
- },
18
- ],
19
- }
20
- }
21
- loading={false}
22
- />
23
- `;
3
+ exports[`<IngestsLoader /> matches the latest snapshot 1`] = `<div />`;
@@ -1,33 +1,24 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<IngestsTable /> matches the latest snapshot 1`] = `
4
- <Fragment>
5
- <Table
6
- as="table"
7
- selectable={true}
8
- sortable={true}
4
+ <div>
5
+ <table
6
+ class="ui selectable sortable table"
9
7
  >
10
- <TableHeader
11
- as="thead"
8
+ <thead
9
+ class=""
12
10
  >
13
- <TableRow
14
- as="tr"
15
- cellAs="td"
11
+ <tr
12
+ class=""
16
13
  />
17
- </TableHeader>
18
- <TableBody
19
- as="tbody"
14
+ </thead>
15
+ <tbody
16
+ class=""
20
17
  >
21
- <IngestRow
22
- columns={[]}
23
- ingest={
24
- {
25
- "id": 1,
26
- }
27
- }
28
- key="0"
18
+ <tr
19
+ class=""
29
20
  />
30
- </TableBody>
31
- </Table>
32
- </Fragment>
21
+ </tbody>
22
+ </table>
23
+ </div>
33
24
  `;
@@ -41,5 +41,5 @@ export {
41
41
  IngestSelectedFiltersPending,
42
42
  IngestSelectedFiltersPublished,
43
43
  IngestTabs,
44
- FieldGroupTable
44
+ FieldGroupTable,
45
45
  };
@@ -1,16 +1,16 @@
1
1
  export const mapActionProps = {
2
2
  publish: {
3
- primary: true
3
+ primary: true,
4
4
  },
5
5
  version: {
6
- primary: true
6
+ primary: true,
7
7
  },
8
8
  send_for_approval: {
9
- primary: true
9
+ primary: true,
10
10
  },
11
11
  reject: {
12
- negative: true
13
- }
12
+ negative: true,
13
+ },
14
14
  };
15
15
 
16
16
  export const mapStatusColor = {
@@ -19,5 +19,5 @@ export const mapStatusColor = {
19
19
  pending_approval: "teal",
20
20
  published: "green",
21
21
  rejected: "red",
22
- versioned: "yellow"
22
+ versioned: "yellow",
23
23
  };
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import { connect } from "react-redux";
4
3
  import { Button, Icon } from "semantic-ui-react";
5
4
  import { FormattedMessage } from "react-intl";
@@ -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 } 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 { linkTo } from "@truedat/core/routes";
9
8
 
@@ -1,13 +1,13 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Route, Switch } from "react-router-dom";
4
+ import { Route, Routes } from "react-router";
5
5
  import { connect } from "react-redux";
6
6
  import {
7
7
  INGEST_RELATIONS_INGESTS,
8
8
  INGEST_RELATIONS_INGESTS_NEW,
9
9
  INGEST_RELATIONS_STRUCTURES,
10
- INGEST_RELATIONS_STRUCTURES_NEW
10
+ INGEST_RELATIONS_STRUCTURES_NEW,
11
11
  } from "@truedat/core/routes";
12
12
  import IngestsLoader from "../../components/IngestsLoader";
13
13
  import IngestFiltersLoader from "../../components/IngestFiltersLoader";
@@ -16,84 +16,82 @@ import IngestToDataStructureRelations from "./IngestToDataStructureRelations";
16
16
  import IngestToStructureForm from "./IngestToStructureForm";
17
17
  import IngestToIngestForm from "./IngestToIngestForm";
18
18
 
19
- const RelationsLoader = React.lazy(() =>
20
- import("@truedat/lm/components/RelationsLoader")
19
+ const RelationsLoader = React.lazy(
20
+ () => import("@truedat/lm/components/RelationsLoader")
21
21
  );
22
22
 
23
- const StructureTypesLoader = React.lazy(() =>
24
- import("@truedat/dd/components/StructureTypesLoader")
23
+ const StructureTypesLoader = React.lazy(
24
+ () => import("@truedat/dd/components/StructureTypesLoader")
25
25
  );
26
26
 
27
- export const IngestRelationsRoutes = ({ ingestId, ingestLoaded }) => (
28
- <Switch>
29
- <Route
30
- exact
31
- path={INGEST_RELATIONS_STRUCTURES}
32
- render={() =>
33
- ingestLoaded && (
34
- <>
35
- <RelationsLoader
36
- resource_id={ingestId}
37
- resource_type="ingest"
38
- target_type="data_structure"
39
- />
40
- <StructureTypesLoader />
41
- <IngestToDataStructureRelations />
42
- </>
43
- )
44
- }
45
- />
46
- <Route
47
- exact
48
- path={INGEST_RELATIONS_INGESTS}
49
- render={() =>
50
- ingestLoaded && (
51
- <>
52
- <RelationsLoader
53
- resource_id={ingestId}
54
- resource_type="ingest"
55
- target_type="ingest"
56
- />
57
- <IngestToIngestRelations />
58
- </>
59
- )
60
- }
61
- />
62
- <Route
63
- exact
64
- path={INGEST_RELATIONS_STRUCTURES_NEW}
65
- render={() => ingestLoaded && <IngestToStructureForm />}
66
- />
67
- <Route
68
- exact
69
- path={INGEST_RELATIONS_INGESTS_NEW}
70
- render={() =>
71
- ingestLoaded && (
72
- <>
73
- <IngestsLoader
74
- pageSize={7}
75
- defaultFilters={{
76
- current: [true],
77
- status: ["pending_approval", "draft", "rejected", "published"]
78
- }}
79
- />
80
- <IngestFiltersLoader />
81
- <IngestToIngestForm targetType="ingest" />
82
- </>
83
- )
84
- }
85
- />
86
- </Switch>
87
- );
27
+ export const IngestRelationsRoutes = ({ ingestId, ingestLoaded }) =>
28
+ ingestLoaded ? (
29
+ <Routes>
30
+ <Route path={INGEST_RELATIONS_STRUCTURES}>
31
+ <Route
32
+ index
33
+ element={
34
+ <>
35
+ <RelationsLoader
36
+ resource_id={ingestId}
37
+ resource_type="ingest"
38
+ target_type="data_structure"
39
+ />
40
+ <StructureTypesLoader />
41
+ <IngestToDataStructureRelations />
42
+ </>
43
+ }
44
+ />
45
+ <Route path="new" element={<IngestToStructureForm />} />
46
+ </Route>
47
+
48
+ <Route path={INGEST_RELATIONS_INGESTS}>
49
+ <Route
50
+ index
51
+ element={
52
+ <>
53
+ <RelationsLoader
54
+ resource_id={ingestId}
55
+ resource_type="ingest"
56
+ target_type="ingest"
57
+ />
58
+ <IngestToIngestRelations />
59
+ </>
60
+ }
61
+ />
62
+ <Route
63
+ path="new"
64
+ element={
65
+ <>
66
+ <IngestsLoader
67
+ pageSize={7}
68
+ defaultFilters={{
69
+ current: [true],
70
+ status: [
71
+ "pending_approval",
72
+ "draft",
73
+ "rejected",
74
+ "published",
75
+ ],
76
+ }}
77
+ />
78
+ <IngestFiltersLoader />
79
+ <IngestToIngestForm targetType="ingest" />
80
+ </>
81
+ }
82
+ />
83
+ </Route>
84
+ </Routes>
85
+ ) : null;
88
86
 
89
87
  IngestRelationsRoutes.propTypes = {
90
88
  ingestId: PropTypes.number,
91
- ingestLoaded: PropTypes.bool
89
+ ingestLoaded: PropTypes.bool,
92
90
  };
93
91
 
94
92
  const mapStateToProps = ({ ingest }) => ({
95
93
  ingestLoaded: !_.isEmpty(ingest),
96
- ingestId: _.prop("ingest_id")(ingest)
94
+ ingestId: _.prop("ingest_id")(ingest),
97
95
  });
98
96
 
99
97
  export default connect(mapStateToProps)(IngestRelationsRoutes);
@@ -1,12 +1,12 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { lazy } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Segment } from "semantic-ui-react";
6
6
  import { getIngestLinks } from "../selectors";
7
7
  import IngestLinksActions from "./IngestLinksActions";
8
8
 
9
- const LinksPane = React.lazy(() => import("@truedat/lm/components/LinksPane"));
9
+ const LinksPane = lazy(() => import("@truedat/lm/components/LinksPane"));
10
10
 
11
11
  export const IngestStructureLinksPane = ({ groups }) => (
12
12
  <Segment attached="bottom">
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { lazy, Component } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Button, Divider } from "semantic-ui-react";
@@ -13,11 +13,11 @@ import { makeTagOptionsSelector } from "@truedat/core/selectors";
13
13
  import { linkTo } from "@truedat/core/routes";
14
14
  import IngestsSelector from "../../components/IngestsSelector";
15
15
 
16
- const TagTypeSelector = React.lazy(() =>
17
- import("@truedat/lm/components/TagTypeSelector")
16
+ const TagTypeSelector = lazy(
17
+ () => import("@truedat/lm/components/TagTypeSelector")
18
18
  );
19
19
 
20
- export class IngestToIngestForm extends React.Component {
20
+ export class IngestToIngestForm extends Component {
21
21
  state = {
22
22
  selectedIngest: null,
23
23
  };
@@ -1,12 +1,12 @@
1
- import React from "react";
1
+ import { lazy } from "react";
2
2
  import { connect } from "react-redux";
3
3
  import { getIngestRelations } from "../selectors/getRelations";
4
4
 
5
- const Relations = React.lazy(() => import("@truedat/lm/components/Relations"));
5
+ const Relations = lazy(() => import("@truedat/lm/components/Relations"));
6
6
 
7
- const mapStateToProps = state => ({
7
+ const mapStateToProps = (state) => ({
8
8
  relations: getIngestRelations(state),
9
- relationsLoading: state.relationsLoading
9
+ relationsLoading: state.relationsLoading,
10
10
  });
11
11
 
12
12
  export default connect(mapStateToProps)(Relations);
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { lazy, Component } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Button, Divider } from "semantic-ui-react";
@@ -12,14 +12,14 @@ import {
12
12
  } from "@truedat/core/routines";
13
13
  import { makeTagOptionsSelector } from "@truedat/core/selectors";
14
14
 
15
- const StructureSelector = React.lazy(() =>
16
- import("@truedat/dd/components/StructureSelector")
15
+ const StructureSelector = lazy(
16
+ () => import("@truedat/dd/components/StructureSelector")
17
17
  );
18
- const TagTypeSelector = React.lazy(() =>
19
- import("@truedat/lm/components/TagTypeSelector")
18
+ const TagTypeSelector = lazy(
19
+ () => import("@truedat/lm/components/TagTypeSelector")
20
20
  );
21
21
 
22
- export class IngestToStructureForm extends React.Component {
22
+ export class IngestToStructureForm extends Component {
23
23
  state = { selectedStructure: null };
24
24
  handleStructureSelected = (selectedStructure) =>
25
25
  this.setState({ selectedStructure });
@@ -1,10 +1,86 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
2
+ import { render, waitForLoad } from "@truedat/test/render";
3
3
  import { IngestRelationsRoutes } from "../IngestRelationsRoutes";
4
+ import {
5
+ INGEST_RELATIONS_INGESTS,
6
+ INGEST_RELATIONS_INGESTS_NEW,
7
+ INGEST_RELATIONS_STRUCTURES,
8
+ INGEST_RELATIONS_STRUCTURES_NEW,
9
+ } from "@truedat/core/routes";
10
+
11
+ // Mock all child components
12
+ jest.mock("../../../components/IngestsLoader", () => () => (
13
+ <div>IngestsLoader</div>
14
+ ));
15
+ jest.mock("../../../components/IngestFiltersLoader", () => () => (
16
+ <div>IngestFiltersLoader</div>
17
+ ));
18
+ jest.mock("../IngestToIngestRelations", () => () => (
19
+ <div>IngestToIngestRelations</div>
20
+ ));
21
+ jest.mock("../IngestToDataStructureRelations", () => () => (
22
+ <div>IngestToDataStructureRelations</div>
23
+ ));
24
+ jest.mock("../IngestToStructureForm", () => () => (
25
+ <div>IngestToStructureForm</div>
26
+ ));
27
+ jest.mock("../IngestToIngestForm", () => () => <div>IngestToIngestForm</div>);
28
+ jest.mock("@truedat/lm/components/RelationsLoader", () => () => (
29
+ <div>RelationsLoader</div>
30
+ ));
31
+ jest.mock("@truedat/dd/components/StructureTypesLoader", () => () => (
32
+ <div>StructureTypesLoader</div>
33
+ ));
4
34
 
5
35
  describe("<IngestRelationsRoutes />", () => {
6
- it("matches the latest snapshot", () => {
7
- const wrapper = shallow(<IngestRelationsRoutes />);
8
- expect(wrapper).toMatchSnapshot();
36
+ const props = {
37
+ ingestId: 123,
38
+ ingestLoaded: true,
39
+ };
40
+
41
+ it("renders correctly with default route", async () => {
42
+ const rendered = render(<IngestRelationsRoutes {...props} />);
43
+ await waitForLoad(rendered);
44
+ expect(rendered.container).toMatchSnapshot();
45
+ });
46
+
47
+ it("renders correctly with structures route", async () => {
48
+ const rendered = render(<IngestRelationsRoutes {...props} />, {
49
+ routes: [INGEST_RELATIONS_STRUCTURES.replace(":id", "123")],
50
+ });
51
+ await waitForLoad(rendered);
52
+ expect(rendered.container).toMatchSnapshot();
53
+ });
54
+
55
+ it("renders correctly with structures/new route", async () => {
56
+ const rendered = render(<IngestRelationsRoutes {...props} />, {
57
+ routes: [INGEST_RELATIONS_STRUCTURES_NEW.replace(":id", "123")],
58
+ });
59
+ await waitForLoad(rendered);
60
+ expect(rendered.container).toMatchSnapshot();
61
+ });
62
+
63
+ it("renders correctly with ingests route", async () => {
64
+ const rendered = render(<IngestRelationsRoutes {...props} />, {
65
+ routes: [INGEST_RELATIONS_INGESTS.replace(":id", "123")],
66
+ });
67
+ await waitForLoad(rendered);
68
+ expect(rendered.container).toMatchSnapshot();
69
+ });
70
+
71
+ it("renders correctly with ingests/new route", async () => {
72
+ const rendered = render(<IngestRelationsRoutes {...props} />, {
73
+ routes: [INGEST_RELATIONS_INGESTS_NEW.replace(":id", "123")],
74
+ });
75
+ await waitForLoad(rendered);
76
+ expect(rendered.container).toMatchSnapshot();
77
+ });
78
+
79
+ it("renders nothing when ingest is not loaded", async () => {
80
+ const rendered = render(
81
+ <IngestRelationsRoutes ingestId={123} ingestLoaded={false} />
82
+ );
83
+ await waitForLoad(rendered);
84
+ expect(rendered.container).toMatchSnapshot();
9
85
  });
10
86
  });
@@ -1,37 +1,36 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { IngestToIngestForm } from "../IngestToIngestForm";
4
3
 
5
4
  describe("<IngestToIngestForm />", () => {
6
- it("matches the latest snapshot", () => {
5
+ it("matches the latest snapshot", async () => {
7
6
  const tagOptions = [];
8
7
  const ingest = {};
9
- const props = { tagOptions, ingest };
10
- const wrapper = shallow(<IngestToIngestForm {...props} />);
11
- expect(wrapper).toMatchSnapshot();
8
+ const props = {
9
+ tagOptions,
10
+ ingest,
11
+ clearSelectedRelationTags: jest.fn(),
12
+ createRelation: jest.fn(),
13
+ selectedRelationTags: [],
14
+ };
15
+ const rendered = render(<IngestToIngestForm {...props} />);
16
+ await waitForLoad(rendered);
17
+ expect(rendered.container).toMatchSnapshot();
12
18
  });
13
19
 
14
- it("render TagTypeSelector when tagOptions is not empty", () => {
20
+ it("renders TagTypeSelector when tagOptions is not empty", async () => {
15
21
  const tagOptions = [{ text: "some text", value: "some value" }];
16
22
  const ingest = {};
17
23
  const selectedRelationTags = [];
18
- const props = { tagOptions, ingest, selectedRelationTags };
19
- const wrapper = shallow(<IngestToIngestForm {...props} />);
20
- expect(wrapper.findWhere(n => n.prop("selectedRelationTags")).length).toBe(
21
- 1
22
- );
23
- });
24
-
25
- it("render TagTypeSelector when tagOptions is not empty", () => {
26
- const tagOptions = [{ text: "some text", value: "some value" }];
27
- const ingest = { name: "Ingest name", ingest_id: "2", id: 2, version: 3 };
28
- const selectedIngest = { type: "ingest type", name: "my ingest" };
29
- const selectedRelationTags = [];
30
- const createRelation = jest.fn();
31
- const props = { createRelation, tagOptions, ingest, selectedRelationTags };
32
- const wrapper = shallow(<IngestToIngestForm {...props} />);
33
- wrapper.setState({ selectedIngest });
34
- wrapper.find({ primary: true }).simulate("click");
35
- expect(createRelation.mock.calls.length).toEqual(1);
24
+ const props = {
25
+ tagOptions,
26
+ ingest,
27
+ selectedRelationTags,
28
+ clearSelectedRelationTags: jest.fn(),
29
+ createRelation: jest.fn(),
30
+ selectedRelationTags: [],
31
+ };
32
+ const rendered = render(<IngestToIngestForm {...props} />);
33
+ await waitForLoad(rendered);
34
+ expect(rendered.getByText("relations.relationType")).toBeInTheDocument();
36
35
  });
37
36
  });