@truedat/dd 4.37.0 → 4.37.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 (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +5 -5
  3. package/src/api.js +6 -7
  4. package/src/components/GrantSelectedFilters.js +3 -10
  5. package/src/components/StructureSelectedFilters.js +18 -17
  6. package/src/components/StructureSelector.js +2 -2
  7. package/src/components/StructuresRoutes.js +2 -2
  8. package/src/components/UserSearchFiltersLoader.js +29 -0
  9. package/src/components/__tests__/UserSearchFiltersLoader.spec.js +27 -0
  10. package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +3 -1
  11. package/src/components/__tests__/__snapshots__/UserSearchFiltersLoader.spec.js.snap +3 -0
  12. package/src/messages/en.js +6 -6
  13. package/src/messages/es.js +6 -6
  14. package/src/reducers/__tests__/grantQuery.spec.js +0 -9
  15. package/src/reducers/__tests__/selectedUserSearchFilter.spec.js +62 -0
  16. package/src/reducers/__tests__/structureActiveFilters.spec.js +12 -12
  17. package/src/reducers/__tests__/structureQuery.spec.js +10 -10
  18. package/src/reducers/__tests__/structureUserFilters.spec.js +26 -26
  19. package/src/reducers/grantFiltersLoading.js +14 -0
  20. package/src/reducers/index.js +6 -4
  21. package/src/reducers/selectedUserSearchFilter.js +48 -0
  22. package/src/reducers/structureActiveFilters.js +4 -4
  23. package/src/reducers/structureQuery.js +2 -2
  24. package/src/reducers/structures.js +1 -1
  25. package/src/reducers/{structureUserFilters.js → userSearchFilters.js} +11 -14
  26. package/src/routines.js +8 -12
  27. package/src/sagas/__tests__/deleteUserSearchFilter.spec.js +72 -0
  28. package/src/sagas/__tests__/fetchUserSearchFilters.spec.js +69 -0
  29. package/src/sagas/__tests__/saveUserSearchFilters.spec.js +78 -0
  30. package/src/sagas/deleteUserSearchFilter.js +31 -0
  31. package/src/sagas/fetchUserSearchFilters.js +26 -0
  32. package/src/sagas/index.js +9 -9
  33. package/src/sagas/saveUserSearchFilters.js +30 -0
  34. package/src/selectors/getStructureSelectedFilterValues.js +3 -5
  35. package/src/components/StructureUserFiltersLoader.js +0 -30
  36. package/src/components/__tests__/StructureUserFiltersLoader.spec.js +0 -27
  37. package/src/components/__tests__/__snapshots__/StructureUserFiltersLoader.spec.js.snap +0 -3
  38. package/src/reducers/__tests__/structureSelectedUserFilter.spec.js +0 -64
  39. package/src/reducers/structureSelectedUserFilter.js +0 -34
  40. package/src/sagas/__tests__/deleteStructureUserFilter.spec.js +0 -75
  41. package/src/sagas/__tests__/fetchStructureUserFilters.spec.js +0 -70
  42. package/src/sagas/__tests__/saveStructureUserFilters.spec.js +0 -73
  43. package/src/sagas/deleteStructureUserFilter.js +0 -34
  44. package/src/sagas/fetchStructureUserFilters.js +0 -29
  45. package/src/sagas/saveStructureUserFilters.js +0 -31
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.37.4] 2022-02-04
4
+
5
+ ### Changed
6
+
7
+ - [TD-4424] Disable user filters while structure filters are loading. Replaced
8
+ the `linked_concepts_count` filter with the `linked_concepts` filter.
9
+
10
+ ## [4.37.3] 2022-02-03
11
+
12
+ ### Changed
13
+
14
+ - [TD-2929] `StructureUserFilter` specific functionality is now the
15
+ generic `UserSearchFilter` used by DataQuality entities
16
+
3
17
  ## [4.37.0] 2022-01-25
4
18
 
5
19
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.37.0",
3
+ "version": "4.37.4",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -84,9 +84,9 @@
84
84
  ]
85
85
  },
86
86
  "dependencies": {
87
- "@truedat/auth": "4.37.0",
88
- "@truedat/core": "4.37.0",
89
- "@truedat/df": "4.37.0",
87
+ "@truedat/auth": "4.37.4",
88
+ "@truedat/core": "4.37.4",
89
+ "@truedat/df": "4.37.4",
90
90
  "lodash": "^4.17.21",
91
91
  "path-to-regexp": "^1.7.0",
92
92
  "prop-types": "^15.7.2",
@@ -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": "a2584d116d738be9a237f26c617e1400d4a24803"
110
+ "gitHead": "d6a390c1a843d164c28cf7ae174126b6c0e24618"
111
111
  }
package/src/api.js CHANGED
@@ -34,10 +34,9 @@ const API_STRUCTURE_TYPES = "/api/data_structure_types";
34
34
  const API_STRUCTURE_TYPES_LITE = "/api/data_structure_types/lite";
35
35
  const API_STRUCTURES_TAG = "/api/data_structures/:data_structure_id/tags/:id";
36
36
  const API_STRUCTURES_TAGS = "/api/data_structures/:data_structure_id/tags";
37
- const API_STRUCTURE_USER_FILTERS = "/api/data_structure_user_filters";
38
- const API_STRUCTURE_USER_FILTER = "/api/data_structure_user_filters/:id";
39
- const API_GET_STRUCTURE_USER_FILTERS =
40
- "/api/data_structure_user_filters/user/me";
37
+ const API_USER_SEARCH_FILTERS = "/api/user_search_filters";
38
+ const API_USER_SEARCH_FILTER = "/api/user_search_filters/:id";
39
+ const API_GET_USER_SEARCH_FILTERS = "/api/user_search_filters/me";
41
40
  const API_STRUCTURES_UPLOAD =
42
41
  "/api/data_structures/bulk_update_template_content";
43
42
  const API_STRUCTURE_NOTE = "/api/data_structures/:data_structure_id/notes/:id";
@@ -79,11 +78,11 @@ export {
79
78
  API_STRUCTURE_TYPE,
80
79
  API_STRUCTURE_TYPES,
81
80
  API_STRUCTURE_TYPES_LITE,
82
- API_STRUCTURE_USER_FILTERS,
83
- API_STRUCTURE_USER_FILTER,
81
+ API_USER_SEARCH_FILTERS,
82
+ API_USER_SEARCH_FILTER,
83
+ API_GET_USER_SEARCH_FILTERS,
84
84
  API_STRUCTURES_TAG,
85
85
  API_STRUCTURES_TAGS,
86
- API_GET_STRUCTURE_USER_FILTERS,
87
86
  API_STRUCTURES_UPLOAD,
88
87
  API_STRUCTURE_NOTE,
89
88
  API_STRUCTURE_NOTES,
@@ -24,23 +24,16 @@ const translations = (formatMessage) => ({
24
24
 
25
25
  export const mapStateToProps = (state, ownProps) => {
26
26
  const formatMessage = _.pathOr(_.prop("id"), "intl.formatMessage")(ownProps);
27
- const { grantSelectedFilter: selectedFilter } = state;
27
+ const { grantFiltersLoading: loading, grantSelectedFilter: selectedFilter } =
28
+ state;
28
29
 
29
30
  const i18nValues = _.flow(
30
31
  getGrantSelectedFilterValues,
31
32
  _.map(makeOption(translations(formatMessage), selectedFilter))
32
33
  )(state);
33
34
 
34
- // const values = _.flow(
35
- // getGrantSelectedFilterValues,
36
- // _.map((v) => ({ text: v, value: v }))
37
- // )(state);
38
-
39
- // _.map(
40
- // makeOption(translations(formatMessage, structureTypes), selectedFilter)
41
- // )(selectedFilterValues),
42
-
43
35
  return {
36
+ loading,
44
37
  selectedFilter,
45
38
  selectedFilters: getGrantSelectedFilters(state),
46
39
  selectedFilterActiveValues: getGrantSelectedFilterActiveValues(state),
@@ -5,13 +5,13 @@ import { injectIntl } from "react-intl";
5
5
  import { SelectedFilters } from "@truedat/core/components";
6
6
  import { makeOption } from "@truedat/core/services/i18n";
7
7
  import {
8
- applyStructureUserFilter,
8
+ applyUserSearchFilter,
9
9
  closeStructureFilter,
10
- deleteStructureUserFilter,
10
+ deleteUserSearchFilter,
11
11
  openStructureFilter,
12
12
  removeStructureFilter,
13
13
  resetStructureFilters,
14
- saveStructureUserFilters,
14
+ saveUserSearchFilters,
15
15
  toggleStructureFilterValue,
16
16
  } from "../routines";
17
17
  import {
@@ -37,25 +37,25 @@ const translations = (formatMessage, structureTypes) => ({
37
37
  id: `filters.with_profiling.raw.${v}`,
38
38
  defaultMessage: v,
39
39
  }),
40
- linked_concepts_count: (v) =>
41
- formatMessage({
42
- id: `filters.linked_concepts_count.${v}`,
43
- defaultMessage: v,
44
- }),
40
+ linked_concepts: (v) =>
41
+ formatMessage({ id: `filters.linked_concepts.${v}`, defaultMessage: v }),
45
42
  });
46
43
 
47
44
  export const mapStateToProps = (state, ownProps) => {
48
45
  const formatMessage = _.pathOr(_.prop("id"), "intl.formatMessage")(ownProps);
49
- const loading = _.prop("structureFiltersLoading")(state);
50
- const selectedFilter = _.prop("structureSelectedFilter")(state);
46
+ const {
47
+ selectedUserSearchFilter: selectedUserFilter,
48
+ structureActiveFilters: activeFilters,
49
+ structureFiltersLoading: loading,
50
+ structureSelectedFilter: selectedFilter,
51
+ structureTypes,
52
+ userSearchFilters: userFilters,
53
+ } = state;
51
54
  const selectedFilterValues = getStructureSelectedFilterValues(state);
52
55
  const selectedFilterActiveValues =
53
56
  getStructureSelectedFilterActiveValues(state);
54
57
  const selectedFilters = getStructureSelectedFilters(state);
55
- const structureTypes = _.prop("structureTypes")(state);
56
- const { structureSelectedUserFilter: selectedUserFilter } = state;
57
- const { structureActiveFilters: activeFilters } = state;
58
- const { structureUserFilters: userFilters } = state;
58
+
59
59
  return {
60
60
  loading,
61
61
  selectedFilter,
@@ -67,19 +67,20 @@ export const mapStateToProps = (state, ownProps) => {
67
67
  selectedUserFilter,
68
68
  activeFilters,
69
69
  userFilters,
70
+ userFilterScope: "data_structure",
70
71
  };
71
72
  };
72
73
 
73
74
  const mapDispatchToProps = (dispatch) =>
74
75
  bindActionCreators(
75
76
  {
76
- applyUserFilter: applyStructureUserFilter,
77
+ applyUserFilter: applyUserSearchFilter,
77
78
  closeFilter: closeStructureFilter,
78
- deleteUserFilter: deleteStructureUserFilter,
79
+ deleteUserFilter: deleteUserSearchFilter,
79
80
  openFilter: openStructureFilter,
80
81
  removeFilter: removeStructureFilter,
81
82
  resetFilters: resetStructureFilters,
82
- saveFilters: saveStructureUserFilters,
83
+ saveFilters: saveUserSearchFilters,
83
84
  toggleFilterValue: toggleStructureFilterValue,
84
85
  },
85
86
  dispatch
@@ -8,7 +8,7 @@ import StructureDateFilter from "./StructureDateFilter";
8
8
  import StructureFiltersLoader from "./StructureFiltersLoader";
9
9
  import StructureSelectedFilters from "./StructureSelectedFilters";
10
10
  import StructureTypesLoader from "./StructureTypesLoader";
11
- import StructureUserFiltersLoader from "./StructureUserFiltersLoader";
11
+ import UserSearchFiltersLoader from "./UserSearchFiltersLoader";
12
12
  import StructuresLoader from "./StructuresLoader";
13
13
  import StructuresSearch from "./StructuresSearch";
14
14
  import StructuresSearchResults from "./StructuresSearchResults";
@@ -40,7 +40,7 @@ export const StructureSelector = ({
40
40
  <StructuresSearch />
41
41
  <StructureSelectedFilters />
42
42
  <StructureDateFilter />
43
- <StructureUserFiltersLoader />
43
+ <UserSearchFiltersLoader scope="data_structure" />
44
44
  <StructuresSearchResults
45
45
  columns={!_.isEmpty(overwriteColumns) ? overwriteColumns : columns}
46
46
  loading={loading}
@@ -14,7 +14,7 @@ import {
14
14
  import DomainsLoader from "@truedat/bg/taxonomy/components/DomainsLoader";
15
15
  import StructureCrumbs from "./StructureCrumbs";
16
16
  import StructureLoader from "./StructureLoader";
17
- import StructureUserFiltersLoader from "./StructureUserFiltersLoader";
17
+ import UserSearchFiltersLoader from "./UserSearchFiltersLoader";
18
18
  import StructureTagsLoader from "./StructureTagsLoader";
19
19
  import StructureView from "./StructureView";
20
20
  import StructuresBulkUpdate from "./StructuresBulkUpdate";
@@ -71,7 +71,7 @@ const AuthorizedRoutes = () => {
71
71
  path={STRUCTURES}
72
72
  render={() => (
73
73
  <>
74
- <StructureUserFiltersLoader />
74
+ <UserSearchFiltersLoader scope="data_structure" />
75
75
  <UserDomainsLoader
76
76
  permissions={[
77
77
  "publish_structure_note_from_draft",
@@ -0,0 +1,29 @@
1
+ import { useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
4
+ import { clearUserSearchFilters, fetchUserSearchFilters } from "../routines";
5
+
6
+ export const UserSearchFiltersLoader = ({
7
+ clearUserSearchFilters,
8
+ fetchUserSearchFilters,
9
+ scope,
10
+ }) => {
11
+ useEffect(() => {
12
+ fetchUserSearchFilters(scope);
13
+ return () => {
14
+ clearUserSearchFilters();
15
+ };
16
+ }, [clearUserSearchFilters, fetchUserSearchFilters]);
17
+ return null;
18
+ };
19
+
20
+ UserSearchFiltersLoader.propTypes = {
21
+ clearUserSearchFilters: PropTypes.func,
22
+ fetchUserSearchFilters: PropTypes.func,
23
+ scope: PropTypes.string,
24
+ };
25
+
26
+ export default connect(null, {
27
+ clearUserSearchFilters,
28
+ fetchUserSearchFilters,
29
+ })(UserSearchFiltersLoader);
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { shallow, mount } from "enzyme";
3
+ import { UserSearchFiltersLoader } from "../UserSearchFiltersLoader";
4
+
5
+ describe("<UserSearchFiltersLoader />", () => {
6
+ const fetchUserSearchFilters = jest.fn();
7
+ const clearUserSearchFilters = jest.fn();
8
+
9
+ it("matches the latest snapshot", () => {
10
+ const props = { clearUserSearchFilters, fetchUserSearchFilters };
11
+ const wrapper = shallow(<UserSearchFiltersLoader {...props} />);
12
+ expect(wrapper).toMatchSnapshot();
13
+ });
14
+
15
+ it("calls fetchUserSearchFilters when component mounts, clearUserSearchFilters when component unmounts", () => {
16
+ const fetchUserSearchFilters = jest.fn();
17
+ const clearUserSearchFilters = jest.fn();
18
+
19
+ const props = { fetchUserSearchFilters, clearUserSearchFilters };
20
+ const wrapper = mount(<UserSearchFiltersLoader {...props} />);
21
+ expect(clearUserSearchFilters.mock.calls.length).toBe(0);
22
+ expect(fetchUserSearchFilters.mock.calls.length).toBe(1);
23
+ wrapper.unmount();
24
+ expect(clearUserSearchFilters.mock.calls.length).toBe(1);
25
+ expect(fetchUserSearchFilters.mock.calls.length).toBe(1);
26
+ });
27
+ });
@@ -12,7 +12,9 @@ exports[`<StructureSelector /> matches the latest snapshot 1`] = `
12
12
  <Connect(StructuresSearch) />
13
13
  <injectIntl(Connect(SelectedFilters)) />
14
14
  <Connect(StructureDateFilter) />
15
- <Connect(StructureUserFiltersLoader) />
15
+ <Connect(UserSearchFiltersLoader)
16
+ scope="data_structure"
17
+ />
16
18
  <StructuresSearchResults
17
19
  columns={
18
20
  Array [
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<UserSearchFiltersLoader /> matches the latest snapshot 1`] = `""`;
@@ -2,7 +2,7 @@ export default {
2
2
  "alert.createStructureTag.failed.header": "Error creating structure tag",
3
3
  "alert.export.csv": "Export to CSV",
4
4
  "alert.linkStructureTag.failed.header": "Error linking tag to structure",
5
- "alert.saveStructureUserFilters.failed.header": "Error saving filter",
5
+ "alert.saveUserSearchFilters.failed.header": "Error saving filter",
6
6
  "alert.show.more": "Show more",
7
7
  "alert.updateStructureTag.failed.header": "Error editing structure tag",
8
8
  "alert.updateSystem.failed.header": "Error updating system",
@@ -19,9 +19,9 @@ export default {
19
19
  "filters.domain.name.raw": "Domain",
20
20
  "filters.field_type.raw": "Field Type",
21
21
  "filters.group.raw": "Group",
22
- "filters.linked_concepts_count": "Concepts",
23
- "filters.linked_concepts_count.linked": "With concepts",
24
- "filters.linked_concepts_count.unlinked": "Without concepts",
22
+ "filters.linked_concepts": "Concepts",
23
+ "filters.linked_concepts.false": "Without concepts",
24
+ "filters.linked_concepts.true": "With concepts",
25
25
  "filters.name.raw": "Name",
26
26
  "filters.system.name.raw": "System",
27
27
  "filters.tags.raw": "Tags",
@@ -163,7 +163,7 @@ export default {
163
163
  "profiling.field.name": "Name",
164
164
  "profiling.field.null": "Nulls",
165
165
  "profiling.field.unique": "Uniques",
166
- "saveStructureUserFilters.error.name.duplicated": "Duplicated name",
166
+ "saveUserSearchFilters.error.name.duplicated": "Duplicated name",
167
167
  "structure._actions": " ",
168
168
  "structure.actions.delete.confirmation.content":
169
169
  "This structure and all its descendant structures will be deleted. Are you sure?",
@@ -211,7 +211,7 @@ export default {
211
211
  "structure.group": "Group",
212
212
  "structure.inserted_at": "Created at",
213
213
  "structure.lineage": "Lineage",
214
- "structure.linked_concepts_count": "Linked to Concept",
214
+ "structure.linked_concepts": "Linked to Concept",
215
215
  "structure.lopd": "LOPD sensibility",
216
216
  "structure.mark_as_confidential": "Mark as confidential",
217
217
  "structure.mark_as_public": "Mark as public",
@@ -3,7 +3,7 @@ export default {
3
3
  "alert.export.csv": "Exportar a CSV",
4
4
  "alert.linkStructureTag.failed.header":
5
5
  "Error asociando etiqueta a estructura",
6
- "alert.saveStructureUserFilters.failed.header": "Error guardando filtro",
6
+ "alert.saveUserSearchFilters.failed.header": "Error guardando filtro",
7
7
  "alert.show.more": "Mostrar más",
8
8
  "alert.updateStructureTag.failed.header": "Error al editar Etiqueta",
9
9
  "alert.updateSystem.failed.header": "Error actualizando sistema",
@@ -20,9 +20,9 @@ export default {
20
20
  "filters.domain.name.raw": "Dominio",
21
21
  "filters.field_type.raw": "Tipo de Campo",
22
22
  "filters.group.raw": "Grupo",
23
- "filters.linked_concepts_count": "Conceptos",
24
- "filters.linked_concepts_count.linked": "Con conceptos enlazados",
25
- "filters.linked_concepts_count.unlinked": "Sin conceptos enlazados",
23
+ "filters.linked_concepts": "Conceptos",
24
+ "filters.linked_concepts.false": "Sin conceptos enlazados",
25
+ "filters.linked_concepts.true": "Con conceptos enlazados",
26
26
  "filters.name.raw": "Nombre",
27
27
  "filters.system.name.raw": "Sistema",
28
28
  "filters.tags.raw": "Etiquetas",
@@ -166,7 +166,7 @@ export default {
166
166
  "profiling.field.name": "Nombre",
167
167
  "profiling.field.null": "Nulos",
168
168
  "profiling.field.unique": "Únicos",
169
- "saveStructureUserFilters.error.name.duplicated": "Nombre duplicado",
169
+ "saveUserSearchFilters.error.name.duplicated": "Nombre duplicado",
170
170
  "structure._actions": " ",
171
171
  "structure.actions.delete.confirmation.content":
172
172
  "Se va a borrar esta estructura y todas las estructuras descendientes. ¿Está seguro?",
@@ -215,7 +215,7 @@ export default {
215
215
  "structure.group": "Grupo",
216
216
  "structure.inserted_at": "Importada",
217
217
  "structure.lineage": "Trazabilidad",
218
- "structure.linked_concepts_count": "Conectado a concepto",
218
+ "structure.linked_concepts": "Conectado a concepto",
219
219
  "structure.lopd": "Sensibilidad LOPD",
220
220
  "structure.mark_as_confidential": "Marcar como confidencial",
221
221
  "structure.mark_as_public": "Marcar como público",
@@ -47,15 +47,6 @@ describe("reducers: grantQuery", () => {
47
47
  });
48
48
  });
49
49
 
50
- // // it("should return default page when user filter is applied", () => {
51
- // // expect(
52
- // // grantQuery(fooState, { type: applyStructureUserFilter.TRIGGER })
53
- // // ).toEqual({
54
- // // ...fooState,
55
- // // page: 1
56
- // // });
57
- // // });
58
-
59
50
  it("should return default page when filter is toggled", () => {
60
51
  expect(
61
52
  grantQuery(fooState, { type: toggleGrantFilterValue.TRIGGER })
@@ -0,0 +1,62 @@
1
+ import { initialState } from "../selectedUserSearchFilter";
2
+ import {
3
+ applyUserSearchFilter,
4
+ clearUserSearchFilters,
5
+ removeStructureFilter,
6
+ resetStructureFilters,
7
+ } from "../../routines";
8
+ import { selectedUserSearchFilter } from "..";
9
+
10
+ const fooState = { foo: "bar" };
11
+
12
+ describe("reducers: structureActiveFilters", () => {
13
+ it("should provide the initial state", () => {
14
+ expect(selectedUserSearchFilter(undefined, {})).toEqual(initialState);
15
+ });
16
+
17
+ it("should handle the applyUserSearchFilter.TRIGGER action", () => {
18
+ const name = "by country";
19
+ const payload = { userFilter: { name } };
20
+ expect(
21
+ selectedUserSearchFilter(fooState, {
22
+ type: applyUserSearchFilter.TRIGGER,
23
+ payload,
24
+ })
25
+ ).toEqual(name);
26
+
27
+ expect(
28
+ selectedUserSearchFilter(name, {
29
+ type: applyUserSearchFilter.TRIGGER,
30
+ payload,
31
+ })
32
+ ).toEqual(null);
33
+ });
34
+
35
+ it("should handle the removeStructureFilter.TRIGGER action", () => {
36
+ expect(
37
+ selectedUserSearchFilter(fooState, {
38
+ type: removeStructureFilter.TRIGGER,
39
+ })
40
+ ).toEqual(initialState);
41
+ });
42
+
43
+ it("should handle the resetStructureFilters.TRIGGER action", () => {
44
+ expect(
45
+ selectedUserSearchFilter(fooState, {
46
+ type: resetStructureFilters.TRIGGER,
47
+ })
48
+ ).toEqual(initialState);
49
+ });
50
+
51
+ it("should handle the clearUserSearchFilters.TRIGGER action", () => {
52
+ expect(
53
+ selectedUserSearchFilter(fooState, {
54
+ type: clearUserSearchFilters.TRIGGER,
55
+ })
56
+ ).toEqual(initialState);
57
+ });
58
+
59
+ it("should ignore unknown actions", () => {
60
+ expect(selectedUserSearchFilter(fooState, { type: "FOO" })).toBe(fooState);
61
+ });
62
+ });
@@ -1,12 +1,12 @@
1
1
  import { initialState } from "../structureActiveFilters";
2
2
  import {
3
3
  addStructureFilter,
4
- applyStructureUserFilter,
4
+ applyUserSearchFilter,
5
5
  clearStructureFilters,
6
6
  closeStructureFilter,
7
7
  removeStructureFilter,
8
8
  resetStructureFilters,
9
- toggleStructureFilterValue
9
+ toggleStructureFilterValue,
10
10
  } from "../../routines";
11
11
  import { structureActiveFilters } from "..";
12
12
 
@@ -20,7 +20,7 @@ describe("reducers: structureActiveFilters", () => {
20
20
  it("should handle the clearStructureFilters.TRIGGER action", () => {
21
21
  expect(
22
22
  structureActiveFilters(fooState, {
23
- type: clearStructureFilters.TRIGGER
23
+ type: clearStructureFilters.TRIGGER,
24
24
  })
25
25
  ).toEqual(initialState);
26
26
  });
@@ -31,18 +31,18 @@ describe("reducers: structureActiveFilters", () => {
31
31
  expect(
32
32
  structureActiveFilters(fooState, {
33
33
  type: addStructureFilter.TRIGGER,
34
- payload
34
+ payload,
35
35
  })
36
36
  ).toEqual({ ...fooState, baz: [] });
37
37
  });
38
38
 
39
- it("should handle the applyStructureUserFilter.TRIGGER action", () => {
39
+ it("should handle the applyUserSearchFilter.TRIGGER action", () => {
40
40
  const filters = { country: ["Sp"] };
41
- const payload = { userFilter: { filters } };
41
+ const payload = { userFilter: { filters }, scope: "data_structure" };
42
42
  expect(
43
43
  structureActiveFilters(fooState, {
44
- type: applyStructureUserFilter.TRIGGER,
45
- payload
44
+ type: applyUserSearchFilter.TRIGGER,
45
+ payload,
46
46
  })
47
47
  ).toEqual({ ...filters });
48
48
  });
@@ -55,7 +55,7 @@ describe("reducers: structureActiveFilters", () => {
55
55
  expect(
56
56
  structureActiveFilters(state, {
57
57
  type: closeStructureFilter.TRIGGER,
58
- payload
58
+ payload,
59
59
  })
60
60
  ).toEqual({ foo });
61
61
  });
@@ -68,7 +68,7 @@ describe("reducers: structureActiveFilters", () => {
68
68
  expect(
69
69
  structureActiveFilters(state, {
70
70
  type: removeStructureFilter.TRIGGER,
71
- payload
71
+ payload,
72
72
  })
73
73
  ).toEqual({ bar });
74
74
  });
@@ -76,7 +76,7 @@ describe("reducers: structureActiveFilters", () => {
76
76
  it("should handle the resetStructureFilters.TRIGGER action", () => {
77
77
  expect(
78
78
  structureActiveFilters(fooState, {
79
- type: resetStructureFilters.TRIGGER
79
+ type: resetStructureFilters.TRIGGER,
80
80
  })
81
81
  ).toEqual(initialState);
82
82
  });
@@ -89,7 +89,7 @@ describe("reducers: structureActiveFilters", () => {
89
89
  expect(
90
90
  structureActiveFilters(state, {
91
91
  type: toggleStructureFilterValue.TRIGGER,
92
- payload
92
+ payload,
93
93
  })
94
94
  ).toEqual({ foo: ["foo1", "foo3"], bar });
95
95
  });
@@ -1,12 +1,12 @@
1
1
  import {
2
- applyStructureUserFilter,
2
+ applyUserSearchFilter,
3
3
  clearStructureFilters,
4
4
  removeStructureFilter,
5
5
  searchStructures,
6
6
  selectStructurePage,
7
7
  sortStructures,
8
8
  toggleStructureFilterValue,
9
- clearStructuresSort
9
+ clearStructuresSort,
10
10
  } from "../../routines";
11
11
  import { initialState } from "../structureQuery";
12
12
  import { structureQuery } from "..";
@@ -32,7 +32,7 @@ describe("reducers: structureQuery", () => {
32
32
  ).toEqual({
33
33
  ...fooState,
34
34
  page: 1,
35
- query: ""
35
+ query: "",
36
36
  });
37
37
  });
38
38
 
@@ -41,7 +41,7 @@ describe("reducers: structureQuery", () => {
41
41
  structureQuery(fooState, { type: clearStructuresSort.TRIGGER })
42
42
  ).toEqual({
43
43
  ...fooState,
44
- sort: [{ "name.raw": "asc" }]
44
+ sort: [{ "name.raw": "asc" }],
45
45
  });
46
46
  });
47
47
 
@@ -50,16 +50,16 @@ describe("reducers: structureQuery", () => {
50
50
  structureQuery(fooState, { type: removeStructureFilter.TRIGGER })
51
51
  ).toEqual({
52
52
  ...fooState,
53
- page: 1
53
+ page: 1,
54
54
  });
55
55
  });
56
56
 
57
57
  it("should return default page when user filter is applied", () => {
58
58
  expect(
59
- structureQuery(fooState, { type: applyStructureUserFilter.TRIGGER })
59
+ structureQuery(fooState, { type: applyUserSearchFilter.TRIGGER })
60
60
  ).toEqual({
61
61
  ...fooState,
62
- page: 1
62
+ page: 1,
63
63
  });
64
64
  });
65
65
 
@@ -68,7 +68,7 @@ describe("reducers: structureQuery", () => {
68
68
  structureQuery(fooState, { type: toggleStructureFilterValue.TRIGGER })
69
69
  ).toEqual({
70
70
  ...fooState,
71
- page: 1
71
+ page: 1,
72
72
  });
73
73
  });
74
74
 
@@ -96,7 +96,7 @@ describe("reducers: structureQuery", () => {
96
96
  structureQuery(fooState, { type: searchStructures.TRIGGER, payload })
97
97
  ).toMatchObject({
98
98
  query,
99
- sort: [{ _score: "desc" }, { "name.raw": "asc" }]
99
+ sort: [{ _score: "desc" }, { "name.raw": "asc" }],
100
100
  });
101
101
  });
102
102
 
@@ -106,7 +106,7 @@ describe("reducers: structureQuery", () => {
106
106
  structureQuery(fooState, { type: searchStructures.TRIGGER, payload })
107
107
  ).toMatchObject({
108
108
  query: "",
109
- sort: [{ "name.raw": "asc" }]
109
+ sort: [{ "name.raw": "asc" }],
110
110
  });
111
111
  });
112
112
  });