@truedat/bg 4.46.3 → 4.46.4

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 (35) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +5 -5
  3. package/src/concepts/components/ConceptArchiveRow.js +8 -3
  4. package/src/concepts/components/ConceptFiltersLoader.js +1 -0
  5. package/src/concepts/components/ConceptRoutes.js +1 -17
  6. package/src/concepts/components/ConceptSummary.js +11 -6
  7. package/src/concepts/components/Concepts.js +6 -27
  8. package/src/concepts/components/ConceptsActions.js +12 -10
  9. package/src/concepts/components/ConceptsLoader.js +7 -28
  10. package/src/concepts/components/ConceptsPanel.js +34 -0
  11. package/src/concepts/components/ConceptsTable.js +13 -14
  12. package/src/concepts/components/DomainConcepts.js +29 -0
  13. package/src/concepts/components/__tests__/ConceptArchiveRow.spec.js +11 -14
  14. package/src/concepts/components/__tests__/ConceptsLoader.spec.js +2 -5
  15. package/src/concepts/components/__tests__/ConceptsPanel.spec.js +25 -0
  16. package/src/concepts/components/__tests__/__snapshots__/ConceptArchiveRow.spec.js.snap +34 -30
  17. package/src/concepts/components/__tests__/__snapshots__/Concepts.spec.js.snap +1 -30
  18. package/src/concepts/components/__tests__/__snapshots__/ConceptsPanel.spec.js.snap +157 -0
  19. package/src/concepts/components/__tests__/__snapshots__/ConceptsTable.spec.js.snap +36 -2
  20. package/src/concepts/reducers/conceptQuery.js +2 -2
  21. package/src/concepts/reducers/index.js +0 -2
  22. package/src/concepts/relations/components/ConceptSelector.js +6 -3
  23. package/src/concepts/routines.js +0 -6
  24. package/src/messages/en.js +1 -0
  25. package/src/messages/es.js +1 -0
  26. package/src/taxonomy/components/Domain.js +22 -6
  27. package/src/taxonomy/components/DomainCrumbs.js +4 -3
  28. package/src/taxonomy/components/DomainDetail.js +3 -5
  29. package/src/taxonomy/components/DomainRoutes.js +3 -1
  30. package/src/taxonomy/components/DomainTabs.js +19 -5
  31. package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +12 -18
  32. package/src/concepts/components/ConceptsDefaultFiltersLoader.js +0 -23
  33. package/src/concepts/components/__tests__/ConceptsDefaultFiltersLoader.spec.js +0 -18
  34. package/src/concepts/reducers/__tests__/conceptsDefaultFilters.spec.js +0 -37
  35. package/src/concepts/reducers/conceptsDefaultFilters.js +0 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.46.4] 2022-06-16
4
+
5
+ ### Added
6
+
7
+ - [TD-4720] Include concepts tab in domain view
8
+
3
9
  ## [4.46.2] 2022-06-16
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.46.3",
3
+ "version": "4.46.4",
4
4
  "description": "Truedat Web Business Glossary",
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.46.3",
37
+ "@truedat/test": "4.46.4",
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",
@@ -86,8 +86,8 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "4.46.3",
90
- "@truedat/df": "4.46.3",
89
+ "@truedat/core": "4.46.4",
90
+ "@truedat/df": "4.46.4",
91
91
  "file-saver": "^2.0.5",
92
92
  "moment": "^2.24.0",
93
93
  "path-to-regexp": "^1.7.0",
@@ -107,5 +107,5 @@
107
107
  "react-dom": ">= 16.8.6 < 17",
108
108
  "semantic-ui-react": ">= 0.88.2 < 2.1"
109
109
  },
110
- "gitHead": "dfb9df52cce497f8040ba6c17bfb23c9225683d3"
110
+ "gitHead": "dcd0aa42ffe1fb816945154ec2a2d06889dca7e7"
111
111
  }
@@ -13,7 +13,7 @@ export const ConceptArchiveRow = ({
13
13
  status,
14
14
  last_change_at,
15
15
  last_change_by,
16
- version
16
+ version,
17
17
  }) => {
18
18
  const history = useHistory();
19
19
  return (
@@ -23,7 +23,12 @@ export const ConceptArchiveRow = ({
23
23
  }
24
24
  >
25
25
  <Table.Cell
26
- content={<FormattedMessage id={`concepts.status.${status}`} />}
26
+ content={
27
+ <FormattedMessage
28
+ id={`concepts.status.${status}`}
29
+ defaultMessage={status}
30
+ />
31
+ }
27
32
  />
28
33
  <Table.Cell content={version} />
29
34
  <Table.Cell content={_.propOr("", "full_name")(last_change_by)} />
@@ -38,7 +43,7 @@ ConceptArchiveRow.propTypes = {
38
43
  status: PropTypes.string,
39
44
  last_change_at: PropTypes.string,
40
45
  last_change_by: PropTypes.string,
41
- version: PropTypes.number
46
+ version: PropTypes.number,
42
47
  };
43
48
 
44
49
  export default ConceptArchiveRow;
@@ -17,6 +17,7 @@ const makeMapStateToProps = () => {
17
17
  const mapStateToProps = (state, props) => ({
18
18
  selectedFilter: state.conceptSelectedFilter,
19
19
  filters: activeFiltersSelector(state, props),
20
+ defaultFilters: props?.defaultFilters || {},
20
21
  });
21
22
  return mapStateToProps;
22
23
  };
@@ -25,7 +25,6 @@ import ConceptLoader from "./ConceptLoader";
25
25
  import Concepts from "./Concepts";
26
26
  import ConceptsBulkUpdate from "./ConceptsBulkUpdate";
27
27
  import ConceptsLoader from "./ConceptsLoader";
28
- import ConceptsDefaultFiltersLoader from "./ConceptsDefaultFiltersLoader";
29
28
  import ConceptSubscriptionLoader from "./ConceptSubscriptionLoader";
30
29
 
31
30
  const RelationTagsLoader = React.lazy(() =>
@@ -56,19 +55,9 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
56
55
  authorized ? (
57
56
  <>
58
57
  <ConceptUserFiltersLoader />
59
- <ConceptsDefaultFiltersLoader
60
- defaultFilters={{
61
- status: ["pending_approval", "draft", "rejected"],
62
- }}
63
- />
64
58
  <ConceptFiltersLoader
65
59
  defaultFilters={{
66
- status: [
67
- "pending_approval",
68
- "draft",
69
- "rejected",
70
- "published",
71
- ],
60
+ status: ["pending_approval", "draft", "rejected"],
72
61
  }}
73
62
  />
74
63
  <Concepts
@@ -96,11 +85,6 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
96
85
  render={() => (
97
86
  <>
98
87
  <ConceptUserFiltersLoader />
99
- <ConceptsDefaultFiltersLoader
100
- defaultFilters={{
101
- status: ["published"],
102
- }}
103
- />
104
88
  <ConceptFiltersLoader
105
89
  defaultFilters={{
106
90
  status: ["published"],
@@ -28,11 +28,11 @@ FieldValue.propTypes = {
28
28
  field: PropTypes.any,
29
29
  value: PropTypes.any,
30
30
  color: PropTypes.any,
31
- in_progress: PropTypes.bool
31
+ in_progress: PropTypes.bool,
32
32
  };
33
33
 
34
34
  export const ConceptSummary = ({
35
- concept: { status, version, last_change_at, last_change_user, in_progress }
35
+ concept: { status, version, last_change_at, last_change_user, in_progress },
36
36
  }) => (
37
37
  <Segment>
38
38
  <Header as="h3" dividing>
@@ -41,7 +41,12 @@ export const ConceptSummary = ({
41
41
 
42
42
  <FieldValue
43
43
  field="status"
44
- value={<FormattedMessage id={`concepts.status.${status}`} />}
44
+ value={
45
+ <FormattedMessage
46
+ id={`concepts.status.${status}`}
47
+ defaultMessage={status}
48
+ />
49
+ }
45
50
  color={mapStatusColor[status]}
46
51
  in_progress={in_progress}
47
52
  />
@@ -60,12 +65,12 @@ export const ConceptSummary = ({
60
65
  );
61
66
 
62
67
  ConceptSummary.propTypes = {
63
- concept: PropTypes.object
68
+ concept: PropTypes.object,
64
69
  };
65
70
 
66
- const mapStateToProps = state => ({
71
+ const mapStateToProps = (state) => ({
67
72
  concept: state.concept,
68
- fieldValues: getFieldValues(state)
73
+ fieldValues: getFieldValues(state),
69
74
  });
70
75
 
71
76
  export default connect(mapStateToProps)(ConceptSummary);
@@ -1,17 +1,11 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { connect } from "react-redux";
4
- import { Dimmer, Header, Icon, Loader, Segment } from "semantic-ui-react";
3
+ import { Header, Icon, Segment } from "semantic-ui-react";
5
4
  import { FormattedMessage } from "react-intl";
6
- import ConceptsActions from "./ConceptsActions";
7
5
  import ConceptCrumbs from "./ConceptCrumbs";
8
- import ConceptsLabelResults from "./ConceptsLabelResults";
9
- import ConceptsPagination from "./ConceptsPagination";
10
- import ConceptsSearch from "./ConceptsSearch";
11
- import ConceptsTable from "./ConceptsTable";
12
- import ConceptSelectedFilters from "./ConceptSelectedFilters";
6
+ import ConceptsPanel from "./ConceptsPanel";
13
7
 
14
- export const Concepts = ({ loading, header, subheader, icon, ...actions }) => (
8
+ export const Concepts = ({ header, subheader, icon }) => (
15
9
  <>
16
10
  <ConceptCrumbs />
17
11
  <Segment>
@@ -25,17 +19,7 @@ export const Concepts = ({ loading, header, subheader, icon, ...actions }) => (
25
19
  </Header.Content>
26
20
  </Header>
27
21
  <Segment attached="bottom">
28
- <ConceptsActions {...actions} />
29
- <ConceptsSearch />
30
- <ConceptSelectedFilters />
31
- <Dimmer.Dimmable dimmed={loading}>
32
- <Dimmer active={loading} inverted>
33
- <Loader />
34
- </Dimmer>
35
- <ConceptsLabelResults />
36
- <ConceptsTable />
37
- <ConceptsPagination />
38
- </Dimmer.Dimmable>
22
+ <ConceptsPanel />
39
23
  </Segment>
40
24
  </Segment>
41
25
  </>
@@ -44,12 +28,7 @@ export const Concepts = ({ loading, header, subheader, icon, ...actions }) => (
44
28
  Concepts.propTypes = {
45
29
  header: PropTypes.string,
46
30
  icon: PropTypes.string,
47
- loading: PropTypes.bool,
48
- subheader: PropTypes.string
31
+ subheader: PropTypes.string,
49
32
  };
50
33
 
51
- const mapStateToProps = ({ conceptsLoading }) => ({
52
- loading: conceptsLoading
53
- });
54
-
55
- export default connect(mapStateToProps)(Concepts);
34
+ export default Concepts;
@@ -23,8 +23,8 @@ export const ConceptsActions = ({
23
23
  create,
24
24
  createUrl,
25
25
  conceptsDownloading,
26
- conceptActionsLoaded,
27
26
  downloadConcepts,
27
+ hidden,
28
28
  upload,
29
29
  }) => {
30
30
  const { formatMessage } = useIntl();
@@ -32,7 +32,7 @@ export const ConceptsActions = ({
32
32
  _.map((l) => [l, formatMessage({ id: `concepts.props.${l}` })]),
33
33
  _.fromPairs
34
34
  )(staticLabels);
35
- return conceptActionsLoaded ? (
35
+ return hidden ? null : (
36
36
  <div>
37
37
  {create && createUrl && (
38
38
  <Button
@@ -56,25 +56,27 @@ export const ConceptsActions = ({
56
56
  {upload && <ConceptsUploadButton />}
57
57
  <ConceptsUpdateButton />
58
58
  </div>
59
- ) : null;
59
+ );
60
60
  };
61
61
 
62
62
  ConceptsActions.propTypes = {
63
63
  conceptsDownloading: PropTypes.bool,
64
- conceptActionsLoaded: PropTypes.bool,
64
+ hidden: PropTypes.bool,
65
65
  create: PropTypes.bool,
66
66
  createUrl: PropTypes.string,
67
67
  downloadConcepts: PropTypes.func,
68
68
  upload: PropTypes.bool,
69
69
  };
70
70
 
71
- const mapStateToProps = (state) => ({
71
+ const mapStateToProps = ({
72
+ conceptActions,
73
+ conceptsActions,
74
+ conceptsDownloading,
75
+ }) => ({
72
76
  createUrl:
73
- _.isEmpty(state.conceptActions) &&
74
- _.has("create")(state.conceptsActions) &&
75
- CONCEPTS_NEW,
76
- conceptsDownloading: state.conceptsDownloading,
77
- conceptActionsLoaded: _.negate(_.isEmpty)(state.conceptsActions),
77
+ _.isEmpty(conceptActions) && conceptsActions?.create ? CONCEPTS_NEW : null,
78
+ conceptsDownloading: conceptsDownloading,
79
+ hidden: _.isEmpty(conceptsActions),
78
80
  });
79
81
 
80
82
  export default connect(mapStateToProps, { downloadConcepts, uploadConcepts })(
@@ -1,26 +1,15 @@
1
- import _ from "lodash/fp";
2
1
  import { useEffect } from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
5
4
  import { makeSearchQuerySelector } from "@truedat/core/selectors";
6
- import {
7
- clearConcepts,
8
- clearConceptDefaultFilters,
9
- fetchConcepts,
10
- } from "../routines";
5
+ import { clearConcepts, fetchConcepts } from "../routines";
11
6
 
12
- export const ConceptsLoader = ({
13
- clearConcepts,
14
- clearConceptDefaultFilters,
15
- fetchConcepts,
16
- payload,
17
- }) => {
7
+ export const ConceptsLoader = ({ clearConcepts, fetchConcepts, payload }) => {
18
8
  useEffect(() => {
19
9
  return () => {
20
10
  clearConcepts();
21
- clearConceptDefaultFilters();
22
11
  };
23
- }, [clearConcepts, clearConceptDefaultFilters]);
12
+ }, [clearConcepts]);
24
13
  useEffect(() => {
25
14
  fetchConcepts(payload);
26
15
  }, [payload, fetchConcepts]);
@@ -33,27 +22,17 @@ ConceptsLoader.propTypes = {
33
22
  payload: PropTypes.object,
34
23
  };
35
24
 
36
- const defaultFilters = (defaultFilters, conceptsDefaultFilters) =>
37
- defaultFilters || conceptsDefaultFilters;
38
25
  const makeMapStateToProps = () => {
39
26
  const searchQuerySelector = makeSearchQuerySelector(
40
27
  "conceptQuery",
41
28
  "conceptActiveFilters"
42
29
  );
43
30
  const mapStateToProps = (state, props) => ({
44
- payload: searchQuerySelector(state, {
45
- ...props,
46
- defaultFilters: defaultFilters(
47
- _.prop("defaultFilters")(props),
48
- _.prop("conceptsDefaultFilters")(state)
49
- ),
50
- }),
31
+ payload: searchQuerySelector(state, props),
51
32
  });
52
33
  return mapStateToProps;
53
34
  };
54
35
 
55
- export default connect(makeMapStateToProps, {
56
- clearConcepts,
57
- clearConceptDefaultFilters,
58
- fetchConcepts,
59
- })(ConceptsLoader);
36
+ export default connect(makeMapStateToProps, { clearConcepts, fetchConcepts })(
37
+ ConceptsLoader
38
+ );
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
4
+ import { Dimmer, Loader } from "semantic-ui-react";
5
+ import ConceptsActions from "./ConceptsActions";
6
+ import ConceptsLabelResults from "./ConceptsLabelResults";
7
+ import ConceptsPagination from "./ConceptsPagination";
8
+ import ConceptsSearch from "./ConceptsSearch";
9
+ import ConceptsTable from "./ConceptsTable";
10
+ import ConceptSelectedFilters from "./ConceptSelectedFilters";
11
+
12
+ export const ConceptsPanel = ({ loading, ...actions }) => (
13
+ <>
14
+ <ConceptsActions {...actions} />
15
+ <ConceptsSearch />
16
+ <ConceptSelectedFilters />
17
+ <Dimmer.Dimmable dimmed={loading}>
18
+ <Dimmer active={loading} inverted>
19
+ <Loader />
20
+ </Dimmer>
21
+ <ConceptsLabelResults />
22
+ <ConceptsTable />
23
+ <ConceptsPagination />
24
+ </Dimmer.Dimmable>
25
+ </>
26
+ );
27
+
28
+ ConceptsPanel.propTypes = {
29
+ loading: PropTypes.bool,
30
+ };
31
+
32
+ const mapStateToProps = ({ conceptsLoading }) => ({ loading: conceptsLoading });
33
+
34
+ export default connect(mapStateToProps)(ConceptsPanel);
@@ -7,14 +7,15 @@ import { Table, Header, Icon } from "semantic-ui-react";
7
7
  import { FormattedMessage } from "react-intl";
8
8
  import { withRouter } from "react-router";
9
9
  import { getSortInfo, sortColumn } from "@truedat/core/services/sort";
10
- import { CONCEPTS, CONCEPTS_PENDING } from "@truedat/core/routes";
10
+ import { CONCEPTS } from "@truedat/core/routes";
11
11
  import { sortConcepts } from "../routines";
12
12
  import { getConceptsRows, getConceptColumns } from "../selectors";
13
13
  import ConceptRow from "./ConceptRow";
14
14
 
15
15
  export class ConceptsTable extends React.Component {
16
16
  static propTypes = {
17
- conceptsLoading: PropTypes.bool,
17
+ loading: PropTypes.bool,
18
+ sortBy: PropTypes.array,
18
19
  concepts: PropTypes.array,
19
20
  columns: PropTypes.array,
20
21
  location: PropTypes.object,
@@ -23,8 +24,8 @@ export class ConceptsTable extends React.Component {
23
24
 
24
25
  //initial state
25
26
  state = {
26
- sortedColumn: _.prop("column")(getSortInfo(this.props.conceptsSorting)),
27
- direction: _.prop("direction")(getSortInfo(this.props.conceptsSorting)),
27
+ sortedColumn: _.prop("column")(getSortInfo(this.props.sortBy)),
28
+ direction: _.prop("direction")(getSortInfo(this.props.sortBy)),
28
29
  };
29
30
 
30
31
  setDirection = (direction) => {
@@ -36,25 +37,23 @@ export class ConceptsTable extends React.Component {
36
37
  };
37
38
 
38
39
  componentDidUpdate(prevProps) {
39
- if (prevProps.conceptsSorting != this.props.conceptsSorting) {
40
+ if (prevProps.sortBy != this.props.sortBy) {
40
41
  const { column: sortedColumn, direction: direction } = getSortInfo(
41
- this.props.conceptsSorting
42
+ this.props.sortBy
42
43
  );
43
44
  this.setState({ sortedColumn, direction });
44
45
  }
45
46
  }
46
47
 
47
48
  render() {
48
- const { concepts, columns, conceptsLoading, location, sortConcepts } =
49
- this.props;
50
-
49
+ const { concepts, columns, loading, location, sortConcepts } = this.props;
51
50
  const { sortedColumn, direction } = this.state;
52
51
 
53
52
  const pathname = _.prop("pathname")(location);
54
53
  const conceptColumns = columns.filter(
55
54
  (column) =>
56
- (pathname == CONCEPTS && column.name != "status") ||
57
- pathname == CONCEPTS_PENDING
55
+ (pathname === CONCEPTS && column.name != "status") ||
56
+ pathname !== CONCEPTS
58
57
  );
59
58
 
60
59
  return (
@@ -100,7 +99,7 @@ export class ConceptsTable extends React.Component {
100
99
  </Table.Body>
101
100
  </Table>
102
101
  )}
103
- {_.isEmpty(concepts) && !conceptsLoading && (
102
+ {loading || concepts?.length ? null : (
104
103
  <Header as="h4">
105
104
  <Icon name="search" />
106
105
  <Header.Content>
@@ -116,8 +115,8 @@ export class ConceptsTable extends React.Component {
116
115
  const mapStateToProps = (state) => ({
117
116
  columns: getConceptColumns(state),
118
117
  concepts: getConceptsRows(state),
119
- conceptsLoading: state.conceptsLoading,
120
- conceptsSorting: _.path("conceptQuery.sort")(state),
118
+ loading: state.conceptsLoading,
119
+ sortBy: _.path("conceptQuery.sort")(state),
121
120
  });
122
121
 
123
122
  export default compose(
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
4
+ import ConceptsPanel from "./ConceptsPanel";
5
+ import ConceptsLoader from "./ConceptsLoader";
6
+ import ConceptFiltersLoader from "./ConceptFiltersLoader";
7
+
8
+ export const DomainConcepts = ({ domain = {} }) => {
9
+ const defaultFilters = {
10
+ taxonomy: [domain.id],
11
+ current: [true],
12
+ status: ["published"],
13
+ };
14
+ return (
15
+ <>
16
+ <ConceptFiltersLoader defaultFilters={defaultFilters} />
17
+ <ConceptsLoader defaultFilters={defaultFilters} />
18
+ <ConceptsPanel />
19
+ </>
20
+ );
21
+ };
22
+
23
+ DomainConcepts.propTypes = {
24
+ domain: PropTypes.object.isRequired,
25
+ };
26
+
27
+ export const mapStateToProps = ({ domain }) => ({ domain });
28
+
29
+ export default connect(mapStateToProps)(DomainConcepts);
@@ -1,26 +1,23 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
2
+ import { render } from "@truedat/test/render";
3
3
  import ConceptArchiveRow from "../ConceptArchiveRow";
4
4
 
5
- const mockHistory = {
6
- push: jest.fn()
7
- };
8
-
9
- jest.mock("react-router-dom", () => ({
10
- ...jest.requireActual("react-router-dom"),
11
- useHistory: () => mockHistory
12
- }));
13
-
14
5
  describe("<ConceptArchiveRow />", () => {
15
6
  it("matches the latest snapshot", () => {
16
7
  const props = {
17
8
  id: 123,
18
- status: "status",
9
+ status: "draft",
19
10
  last_change_at: "2018-06-27T07:32:53.154377Z",
20
11
  last_change_by: "maixu",
21
- version: 1
12
+ version: 1,
22
13
  };
23
- const wrapper = shallow(<ConceptArchiveRow {...props} />);
24
- expect(wrapper).toMatchSnapshot();
14
+ const { container } = render(
15
+ <table>
16
+ <tbody>
17
+ <ConceptArchiveRow {...props} />
18
+ </tbody>
19
+ </table>
20
+ );
21
+ expect(container).toMatchSnapshot();
25
22
  });
26
23
  });
@@ -4,9 +4,8 @@ import { ConceptsLoader } from "../ConceptsLoader";
4
4
 
5
5
  const getProps = () => ({
6
6
  clearConcepts: jest.fn(),
7
- clearConceptDefaultFilters: jest.fn(),
8
7
  conceptsLoading: false,
9
- fetchConcepts: jest.fn()
8
+ fetchConcepts: jest.fn(),
10
9
  });
11
10
 
12
11
  describe("<ConceptsLoader />", () => {
@@ -18,14 +17,12 @@ describe("<ConceptsLoader />", () => {
18
17
  expect(props.fetchConcepts).toHaveBeenCalledTimes(1);
19
18
  });
20
19
 
21
- it("calls clearConcepts and clearConceptDefaultFilters when component unmounts but not when it mounts", () => {
20
+ it("calls clearConcepts when component unmounts but not when it mounts", () => {
22
21
  const props = getProps();
23
22
  const wrapper = mount(<ConceptsLoader {...props} />);
24
23
  expect(props.clearConcepts).toHaveBeenCalledTimes(0);
25
- expect(props.clearConceptDefaultFilters).toHaveBeenCalledTimes(0);
26
24
  wrapper.unmount();
27
25
  expect(props.clearConcepts).toHaveBeenCalledTimes(1);
28
- expect(props.clearConceptDefaultFilters).toHaveBeenCalledTimes(1);
29
26
  });
30
27
 
31
28
  it("merges default filters with query filters", () => {
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { render } from "@truedat/test/render";
3
+ import ConceptsPanel from "../ConceptsPanel";
4
+
5
+ const renderOpts = {
6
+ state: {
7
+ conceptCount: 123,
8
+ concepts: [
9
+ {
10
+ id: 1,
11
+ name: "concept",
12
+ domain: { name: "domain" },
13
+ status: "published",
14
+ last_change_at: "2020-01-01T00:00:00.000Z",
15
+ },
16
+ ],
17
+ },
18
+ };
19
+
20
+ describe("<ConceptsPanel />", () => {
21
+ it("matches latest snapshot", () => {
22
+ const { container } = render(<ConceptsPanel />, renderOpts);
23
+ expect(container).toMatchSnapshot();
24
+ });
25
+ });
@@ -1,34 +1,38 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<ConceptArchiveRow /> matches the latest snapshot 1`] = `
4
- <TableRow
5
- as="tr"
6
- cellAs="td"
7
- onClick={[Function]}
8
- >
9
- <TableCell
10
- as="td"
11
- content={
12
- <Memo(MemoizedFormattedMessage)
13
- id="concepts.status.status"
14
- />
15
- }
16
- />
17
- <TableCell
18
- as="td"
19
- content={1}
20
- />
21
- <TableCell
22
- as="td"
23
- content=""
24
- />
25
- <TableCell
26
- as="td"
27
- content={
28
- <DateTime
29
- value="2018-06-27T07:32:53.154377Z"
30
- />
31
- }
32
- />
33
- </TableRow>
4
+ <div>
5
+ <table>
6
+ <tbody>
7
+ <tr
8
+ class=""
9
+ >
10
+ <td
11
+ class=""
12
+ >
13
+ Draft
14
+ </td>
15
+ <td
16
+ class=""
17
+ >
18
+ 1
19
+ </td>
20
+ <td
21
+ class=""
22
+ >
23
+
24
+ </td>
25
+ <td
26
+ class=""
27
+ >
28
+ <time
29
+ datetime="1530084773154"
30
+ >
31
+ 2018-06-27 07:32
32
+ </time>
33
+ </td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
37
+ </div>
34
38
  `;