@eeacms/volto-clms-theme 1.1.176 → 1.1.178

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 (22) hide show
  1. package/CHANGELOG.md +33 -3
  2. package/package.json +1 -1
  3. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +34 -51
  4. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit.test.jsx +0 -4
  5. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockView.test.jsx +8 -11
  6. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +62 -119
  7. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +5 -9
  8. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +3 -1
  9. package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +11 -14
  10. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +5 -8
  11. package/src/components/CLMSDownloadCartView/Fields/TimeseriesPicker.jsx +6 -2
  12. package/src/components/CartIconCounter/CartIconCounter.test.jsx +0 -3
  13. package/src/components/CclCard/CclCard.test.jsx +10 -6
  14. package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +23 -34
  15. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +22 -25
  16. package/src/components/CclModal/CclModal.test.js +45 -59
  17. package/src/components/CclTab/CclTab.test.jsx +19 -11
  18. package/src/customizations/volto/components/manage/Contents/ContentsItem.jsx +405 -0
  19. package/theme/site/extras/contents.less +6 -0
  20. package/theme/site/extras/custom.overrides +1 -0
  21. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockEdit.test.jsx.snap +0 -27
  22. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockView.test.jsx.snap +0 -3
package/CHANGELOG.md CHANGED
@@ -4,11 +4,41 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- ### [1.1.176](https://github.com/eea/volto-clms-theme/compare/1.1.175...1.1.176) - 8 August 2024
7
+ ### [1.1.178](https://github.com/eea/volto-clms-theme/compare/1.1.177...1.1.178) - 26 August 2024
8
8
 
9
- #### :hammer_and_wrench: Others
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`d4de906`](https://github.com/eea/volto-clms-theme/commit/d4de906dce029f4b12382c624d399a93b5cea458)]
12
+ - style: Automated code fix [eea-jenkins - [`3cdad9f`](https://github.com/eea/volto-clms-theme/commit/3cdad9f14e176ff8b1bd2f60ae73f074cddcae6d)]
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - More test fixes [Tiberiu Ichim - [`6d0ee04`](https://github.com/eea/volto-clms-theme/commit/6d0ee04c08b40c1630db96f4e3265873a3e674d5)]
17
+ - Fix one test [Tiberiu Ichim - [`7a63d96`](https://github.com/eea/volto-clms-theme/commit/7a63d9613a439b880eb340b1bd44aef46bb2817f)]
18
+ - Refs #273992 - Fix BoundingBoxComponent.test.jsx. [GhitaB - [`e84220f`](https://github.com/eea/volto-clms-theme/commit/e84220f0bea3105a9ee218f17f3a70e180abdea6)]
19
+ - Refs #273992 - Fix DistributionInfoComponent.test.jsx. [GhitaB - [`f96ef4f`](https://github.com/eea/volto-clms-theme/commit/f96ef4f43a06314e3089123afcd97403671638fa)]
20
+ - Refs #273992 - Fix CclExpandableFilter.test.jsx - fix eslint. [GhitaB - [`92efa96`](https://github.com/eea/volto-clms-theme/commit/92efa9610539aba1cd0ba421e9e33b90a042dfee)]
21
+ - Refs #273992 - Fix CclExpandableFilter.test.jsx. [GhitaB - [`65e6b83`](https://github.com/eea/volto-clms-theme/commit/65e6b830c4c7242f1220a88cb1901e789f0dbfec)]
22
+ - Refs #273992 - Fix ContactComponent.test.jsx. [GhitaB - [`d695b38`](https://github.com/eea/volto-clms-theme/commit/d695b38a82ef4a9a87302295de06f9beda5083f7)]
23
+ - Refs #273992 - Fix CartIconCounter.test.jsx. [GhitaB - [`1f191e5`](https://github.com/eea/volto-clms-theme/commit/1f191e552ad85f9d8c0ab942c64fd39813c55cf1)]
24
+ - Refs #273992 - Fix CartIconCounter.test.jsx. [GhitaB - [`20984cc`](https://github.com/eea/volto-clms-theme/commit/20984ccfe404038500ecdaf7866f2512d1358469)]
25
+ - Refs #273992 - Fix CclCard.test.jsx. [GhitaB - [`706c490`](https://github.com/eea/volto-clms-theme/commit/706c490efac2b7c3c56d1a404c7d102288c979f3)]
26
+ - Refs #273992 - CclContextNavigationBlockView.test.jsx - Enzyme -> RTL. [GhitaB - [`e091a63`](https://github.com/eea/volto-clms-theme/commit/e091a631b0b79ccb1ef05a3375e566e34520964e)]
27
+ - Refs #273992 - CclContextNavigationBlockView.test.jsx - Enzyme -> RTL. [GhitaB - [`aba30b9`](https://github.com/eea/volto-clms-theme/commit/aba30b9d7cceba6dd8e9ad0e5313ccc143ea0615)]
28
+ - Refs #273992 - CclContextNavigationBlockView.test.jsx - Enzyme -> RTL. [GhitaB - [`6e88a6e`](https://github.com/eea/volto-clms-theme/commit/6e88a6ef2205401def8120ce4feab7f120ad2733)]
29
+ - Refs #273992 - CclButtonBlockEdit.test.jsx - Enzyme -> RTL - remove obsolete snapshot. [GhitaB - [`c5d917d`](https://github.com/eea/volto-clms-theme/commit/c5d917d72242e7a4dff16a9a0d001c7210ab5f8f)]
30
+ - Refs #273992 - CclButtonBlockEdit.test.jsx - Enzyme -> RTL. [GhitaB - [`dd3ebb3`](https://github.com/eea/volto-clms-theme/commit/dd3ebb3f9f6db8635d316016ceba627161d072b8)]
31
+ - Refs #273992 - CclButtonBlockEdit.test.jsx - Enzyme -> RTL. [GhitaB - [`1c31699`](https://github.com/eea/volto-clms-theme/commit/1c3169940832127cb1cd76b52bd7b2482174ff96)]
32
+ - Refs #273992 - CclModal.test.jsx - Enzyme -> RTL. [GhitaB - [`bab4c3e`](https://github.com/eea/volto-clms-theme/commit/bab4c3ea43321e5447366a2712053544cb204a4f)]
33
+ - Refs #273992 - CclModal.test.jsx - Enzyme -> RTL. [GhitaB - [`97b5078`](https://github.com/eea/volto-clms-theme/commit/97b507870639e0725f7d936edda26897efe5d54d)]
34
+ - Refs #273992 - CclModal.test.jsx - Enzyme -> RTL. [GhitaB - [`b2f064e`](https://github.com/eea/volto-clms-theme/commit/b2f064ec64f7beaf313b13891f78d58c302c547f)]
35
+ - Refs #273992 - CclListingCards.test.jsx - Enzyme -> RTL. [GhitaB - [`ca6ac5f`](https://github.com/eea/volto-clms-theme/commit/ca6ac5f1e56ce01154e1969969142f6432d6f5db)]
36
+ - Refs #273992 - CclListingCards.test.jsx - Enzyme -> RTL. [GhitaB - [`68364ab`](https://github.com/eea/volto-clms-theme/commit/68364ab9110a8d3a8a38ae99d67ae8c47b25aeba)]
37
+ - Refs #273992 - Update README.md (retry tests) [Ghiță Bizău - [`323a348`](https://github.com/eea/volto-clms-theme/commit/323a348092275af300784271ae44997b6b0f39ab)]
38
+ ### [1.1.177](https://github.com/eea/volto-clms-theme/compare/1.1.176...1.1.177) - 8 August 2024
39
+
40
+ ### [1.1.176](https://github.com/eea/volto-clms-theme/compare/1.1.175...1.1.176) - 8 August 2024
10
41
 
11
- - Disable the dropdownMenuNavItems from blacklist reducers [Tiberiu Ichim - [`b6f7f25`](https://github.com/eea/volto-clms-theme/commit/b6f7f25e4b5e526fe2b793ae81a5ccd1160ff2ae)]
12
42
  ### [1.1.175](https://github.com/eea/volto-clms-theme/compare/1.1.174...1.1.175) - 8 August 2024
13
43
 
14
44
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.176",
3
+ "version": "1.1.178",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -1,16 +1,9 @@
1
- import Enzyme, { mount } from 'enzyme';
2
-
3
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
4
1
  import CclButtonBlockEdit from './CclButtonBlockEdit';
5
2
  import { MemoryRouter } from 'react-router-dom';
6
3
  import { Provider } from 'react-intl-redux';
7
4
  import React from 'react';
8
5
  import configureStore from 'redux-mock-store';
9
- import renderer from 'react-test-renderer';
10
-
11
- Enzyme.configure({ adapter: new Adapter() });
12
-
13
- global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
6
+ import { render, fireEvent } from '@testing-library/react';
14
7
 
15
8
  const mockStore = configureStore();
16
9
 
@@ -26,6 +19,7 @@ describe('CclButtonBlockEdit', () => {
26
19
  messages: {},
27
20
  },
28
21
  });
22
+
29
23
  const data = {
30
24
  href: 'https://www.google.com',
31
25
  disabled: false,
@@ -33,29 +27,26 @@ describe('CclButtonBlockEdit', () => {
33
27
  download: false,
34
28
  };
35
29
 
36
- // const component = shallow(
37
- const component = mount(
30
+ const { container } = render(
38
31
  <Provider store={store}>
39
32
  <MemoryRouter>
40
33
  <CclButtonBlockEdit
41
34
  data={data}
42
35
  selected={false}
43
36
  block="1234"
44
- onChangeBlock={() => {
45
- return 'test';
46
- }}
47
- setSidebarTab={() => {
48
- return 'test';
49
- }}
37
+ onChangeBlock={() => 'test'}
38
+ setSidebarTab={() => 'test'}
50
39
  />
51
40
  </MemoryRouter>
52
41
  </Provider>,
53
42
  );
54
- const legend = component.find('.ccl-block-editor-header legend');
55
- legend.simulate('click');
56
- expect(legend).toBeDefined();
43
+
44
+ const legend = container.querySelector('.ccl-block-editor-header legend');
45
+ fireEvent.click(legend);
46
+ expect(legend).not.toBeNull();
57
47
  });
58
- it('renders an CclButtonBlockEdit block component', () => {
48
+
49
+ it('renders a CclButtonBlockEdit block component', () => {
59
50
  const store = mockStore({
60
51
  content: {
61
52
  create: {},
@@ -66,38 +57,34 @@ describe('CclButtonBlockEdit', () => {
66
57
  messages: {},
67
58
  },
68
59
  });
60
+
69
61
  const data = {
70
62
  href: ['https://www.google.com', 'https://www.google.com'],
71
63
  disabled: true,
72
64
  };
73
- const component = renderer.create(
65
+
66
+ const { container } = render(
74
67
  <Provider store={store}>
75
68
  <MemoryRouter>
76
69
  <CclButtonBlockEdit
77
70
  data={data}
78
71
  selected={false}
79
72
  block="1234"
80
- onChangeBlock={() => {
81
- return 'test';
82
- }}
83
- onSelectBlock={() => {
84
- return 'test';
85
- }}
86
- onChangeField={() => {
87
- return 'test';
88
- }}
89
- setSidebarTab={() => {
90
- return 'test';
91
- }}
73
+ onChangeBlock={() => 'test'}
74
+ onSelectBlock={() => 'test'}
75
+ onChangeField={() => 'test'}
76
+ setSidebarTab={() => 'test'}
92
77
  />
93
78
  </MemoryRouter>
94
79
  </Provider>,
95
80
  );
96
81
 
97
- const json = component.toJSON();
98
- expect(json).toMatchSnapshot();
82
+ const button = container.querySelector('.ccl-button.ccl-button--default');
83
+ expect(button).not.toBeNull();
84
+ expect(button.getAttribute('href')).toBe('/');
85
+ expect(button.classList.contains('ccl-button--default')).toBe(true);
99
86
  });
100
- //jest test for CclButtonBlockEdit onChangeBlock statement
87
+
101
88
  it('CclButtonBlockEdit onChangeBlock', () => {
102
89
  const store = mockStore({
103
90
  content: {
@@ -109,34 +96,30 @@ describe('CclButtonBlockEdit', () => {
109
96
  messages: {},
110
97
  },
111
98
  });
99
+
112
100
  const data = {
113
101
  href: ['https://www.google.com', 'https://www.google.com'],
114
102
  disabled: true,
115
103
  };
116
- const component = mount(
104
+
105
+ const { container } = render(
117
106
  <Provider store={store}>
118
107
  <MemoryRouter>
119
108
  <CclButtonBlockEdit
120
109
  data={data}
121
110
  selected={false}
122
111
  block="1234"
123
- onChangeBlock={() => {
124
- return 'test';
125
- }}
126
- onSelectBlock={() => {
127
- return 'test';
128
- }}
129
- onChangeField={() => {
130
- return 'test';
131
- }}
132
- setSidebarTab={() => {
133
- return 'test';
134
- }}
112
+ onChangeBlock={() => 'test'}
113
+ onSelectBlock={() => 'test'}
114
+ onChangeField={() => 'test'}
115
+ setSidebarTab={() => 'test'}
135
116
  />
136
117
  </MemoryRouter>
137
118
  </Provider>,
138
119
  );
139
- const legend = component.find('.ccl-block-editor-header');
140
- legend.simulate('click');
120
+
121
+ const legend = container.querySelector('.ccl-block-editor-header legend');
122
+ fireEvent.click(legend);
123
+ expect(legend).not.toBeNull();
141
124
  });
142
125
  });
@@ -4,10 +4,6 @@ import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import CclContextNavigationBlockEdit from './CclContextNavigationBlockEdit';
6
6
  import { MemoryRouter } from 'react-router-dom';
7
- import Enzyme from 'enzyme';
8
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
9
-
10
- Enzyme.configure({ adapter: new Adapter() });
11
7
 
12
8
  global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
13
9
 
@@ -1,20 +1,14 @@
1
1
  import React from 'react';
2
- import renderer from 'react-test-renderer';
2
+ import { render } from '@testing-library/react';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import CclContextNavigationBlockView from './CclContextNavigationBlockView';
6
6
  import { MemoryRouter } from 'react-router-dom';
7
- import Enzyme from 'enzyme';
8
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
9
-
10
- Enzyme.configure({ adapter: new Adapter() });
11
-
12
- global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
13
7
 
14
8
  const mockStore = configureStore();
15
9
 
16
10
  describe('CclContextNavigationBlockView', () => {
17
- it('Check context navigation view', () => {
11
+ it('renders CclContextNavigationBlockView correctly', () => {
18
12
  const store = mockStore({
19
13
  content: {
20
14
  create: {},
@@ -27,7 +21,7 @@ describe('CclContextNavigationBlockView', () => {
27
21
  });
28
22
  const pathname = '/example';
29
23
 
30
- const ContextNavigationBlockView = renderer.create(
24
+ const { container } = render(
31
25
  <Provider store={store}>
32
26
  <MemoryRouter>
33
27
  <CclContextNavigationBlockView pathname={pathname}>
@@ -36,7 +30,10 @@ describe('CclContextNavigationBlockView', () => {
36
30
  </MemoryRouter>
37
31
  </Provider>,
38
32
  );
39
- const json = ContextNavigationBlockView.toJSON();
40
- expect(json).toMatchSnapshot();
33
+
34
+ const contextNavigationBlock = container.querySelector(
35
+ '.ccl-context-navigation-block',
36
+ );
37
+ expect(contextNavigationBlock).toBeNull();
41
38
  });
42
39
  });
@@ -1,14 +1,10 @@
1
- import Enzyme, { mount } from 'enzyme';
2
-
3
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
1
+ import { render, screen } from '@testing-library/react';
4
2
  import CclListingCards from './CclListingCards';
5
3
  import { MemoryRouter } from 'react-router-dom';
6
4
  import { Provider } from 'react-intl-redux';
7
5
  import React from 'react';
8
6
  import configureStore from 'redux-mock-store';
9
7
 
10
- Enzyme.configure({ adapter: new Adapter() });
11
-
12
8
  const mockStore = configureStore();
13
9
  const store = mockStore({
14
10
  content: {
@@ -32,175 +28,122 @@ const store = mockStore({
32
28
  },
33
29
  },
34
30
  });
31
+
35
32
  const internalLink = [{ '@id': '/news' }];
36
- const externalLink = [{ '@id': 'https://wwww.google.com' }];
33
+ const externalLink = [{ '@id': 'https://www.google.com' }];
37
34
 
38
35
  describe('CclListingCards', () => {
39
- it('News listing card internal link', () => {
40
- const items = [
41
- {
42
- title: 'Card Title',
43
- description: 'Card description',
44
- image: {
45
- download:
46
- 'https://localhost:3000/news/new/@@images/image/filename.jpg',
47
- },
36
+ const items = [
37
+ {
38
+ title: 'Card Title',
39
+ description: 'Card description',
40
+ image: {
41
+ download: 'https://localhost:3000/news/new/@@images/image/filename.jpg',
48
42
  },
49
- ];
50
- const linkTitle = 'More news';
51
- const isEditMode = true;
52
- const variation = 'CclCardsnews';
53
- const component = mount(
43
+ },
44
+ ];
45
+
46
+ it('renders a news listing card with an internal link', () => {
47
+ render(
54
48
  <Provider store={store}>
55
49
  <MemoryRouter>
56
50
  <CclListingCards
57
51
  items={items}
58
52
  linkHref={internalLink}
59
- linkTitle={linkTitle}
60
- isEditMode={isEditMode}
61
- variation={variation}
62
- ></CclListingCards>
53
+ linkTitle="More news"
54
+ isEditMode={true}
55
+ variation="CclCardsnews"
56
+ />
63
57
  </MemoryRouter>
64
58
  </Provider>,
65
59
  );
66
- expect(component).toBeDefined();
60
+
61
+ expect(screen.getByText('Card Title')).toBeDefined();
67
62
  });
68
- it('Line-color listing card external link', () => {
69
- const items = [
70
- {
71
- title: 'Card Title',
72
- description: 'Card description',
73
- image: {
74
- download:
75
- 'https://localhost:3000/news/new/@@images/image/filename.jpg',
76
- },
77
- },
78
- ];
79
- const linkTitle = 'More line-color';
80
- const isEditMode = true;
81
- const variation = 'CclCardsline-color';
82
- const component = mount(
63
+
64
+ it('renders a line-color listing card with an external link', () => {
65
+ render(
83
66
  <Provider store={store}>
84
67
  <MemoryRouter>
85
68
  <CclListingCards
86
69
  items={items}
87
70
  linkHref={externalLink}
88
- linkTitle={linkTitle}
89
- isEditMode={isEditMode}
90
- variation={variation}
91
- ></CclListingCards>
71
+ linkTitle="More line-color"
72
+ isEditMode={true}
73
+ variation="CclCardsline-color"
74
+ />
92
75
  </MemoryRouter>
93
76
  </Provider>,
94
77
  );
95
- expect(component).toBeDefined();
78
+
79
+ expect(screen.getByText('Card Title')).toBeDefined();
96
80
  });
97
- it('line listing card external link', () => {
98
- const items = [
99
- {
100
- title: 'Card Title',
101
- description: 'Card description',
102
- image: {
103
- download:
104
- 'https://localhost:3000/news/new/@@images/image/filename.jpg',
105
- },
106
- },
107
- ];
108
- const linkTitle = 'More line';
109
- const isEditMode = true;
110
- const variation = 'CclCardsline';
111
- const component = mount(
81
+
82
+ it('renders a line listing card with an external link', () => {
83
+ render(
112
84
  <Provider store={store}>
113
85
  <MemoryRouter>
114
86
  <CclListingCards
115
87
  items={items}
116
88
  linkHref={externalLink}
117
- linkTitle={linkTitle}
118
- isEditMode={isEditMode}
119
- variation={variation}
120
- ></CclListingCards>
89
+ linkTitle="More line"
90
+ isEditMode={true}
91
+ variation="CclCardsline"
92
+ />
121
93
  </MemoryRouter>
122
94
  </Provider>,
123
95
  );
124
- expect(component).toBeDefined();
96
+
97
+ expect(screen.getByText('Card Title')).toBeDefined();
125
98
  });
126
- it('without linkHref', () => {
127
- const items = [
128
- {
129
- title: 'Card Title',
130
- description: 'Card description',
131
- image: {
132
- download:
133
- 'https://localhost:3000/news/new/@@images/image/filename.jpg',
134
- },
135
- },
136
- ];
137
- const isEditMode = true;
138
- const variation = 'CclCardsnews';
139
- const component = mount(
99
+
100
+ it('renders a card without a linkHref', () => {
101
+ render(
140
102
  <Provider store={store}>
141
103
  <MemoryRouter>
142
104
  <CclListingCards
143
105
  items={items}
144
- isEditMode={isEditMode}
145
- variation={variation}
146
- ></CclListingCards>
106
+ isEditMode={true}
107
+ variation="CclCardsnews"
108
+ />
147
109
  </MemoryRouter>
148
110
  </Provider>,
149
111
  );
150
- expect(component).toBeDefined();
112
+
113
+ expect(screen.getByText('Card Title')).toBeDefined();
151
114
  });
152
- it('internal link without linkTitle', () => {
153
- const items = [
154
- {
155
- title: 'Card Title',
156
- description: 'Card description',
157
- image: {
158
- download:
159
- 'https://localhost:3000/news/new/@@images/image/filename.jpg',
160
- },
161
- },
162
- ];
163
- const isEditMode = true;
164
- const variation = 'CclCardsnews';
165
- const component = mount(
115
+
116
+ it('renders a card with an internal link but without a linkTitle', () => {
117
+ render(
166
118
  <Provider store={store}>
167
119
  <MemoryRouter>
168
120
  <CclListingCards
169
121
  items={items}
170
122
  linkHref={internalLink}
171
- isEditMode={isEditMode}
172
- variation={variation}
173
- ></CclListingCards>
123
+ isEditMode={true}
124
+ variation="CclCardsnews"
125
+ />
174
126
  </MemoryRouter>
175
127
  </Provider>,
176
128
  );
177
- expect(component).toBeDefined();
129
+
130
+ expect(screen.getByText('Card Title')).toBeDefined();
178
131
  });
179
- it('External link without linkTitle', () => {
180
- const items = [
181
- {
182
- title: 'Card Title',
183
- description: 'Card description',
184
- image: {
185
- download:
186
- 'https://localhost:3000/news/new/@@images/image/filename.jpg',
187
- },
188
- },
189
- ];
190
- const isEditMode = true;
191
- const variation = 'CclCardsnews';
192
- const component = mount(
132
+
133
+ it('renders a card with an external link but without a linkTitle', () => {
134
+ render(
193
135
  <Provider store={store}>
194
136
  <MemoryRouter>
195
137
  <CclListingCards
196
138
  items={items}
197
139
  linkHref={externalLink}
198
- isEditMode={isEditMode}
199
- variation={variation}
200
- ></CclListingCards>
140
+ isEditMode={true}
141
+ variation="CclCardsnews"
142
+ />
201
143
  </MemoryRouter>
202
144
  </Provider>,
203
145
  );
204
- expect(component).toBeDefined();
146
+
147
+ expect(screen.getByText('Card Title')).toBeDefined();
205
148
  });
206
149
  });
@@ -1,15 +1,9 @@
1
- import Enzyme, { mount } from 'enzyme';
2
-
3
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
1
+ import { render } from '@testing-library/react';
4
2
  import BoundingBoxComponent from './BoundingBoxComponent';
5
3
  import { MemoryRouter } from 'react-router-dom';
6
4
  import React from 'react';
7
5
 
8
- Enzyme.configure({ adapter: new Adapter() });
9
-
10
- //jest test for BoundingBoxComponent
11
6
  describe('BoundingBoxComponent', () => {
12
- //test for BoundingBoxComponent rendering
13
7
  it('Check if BoundingBoxComponent is rendered', () => {
14
8
  const boundingBox = {
15
9
  west: -180,
@@ -17,11 +11,13 @@ describe('BoundingBoxComponent', () => {
17
11
  north: 90,
18
12
  south: -90,
19
13
  };
20
- const wrapper = mount(
14
+
15
+ const { container } = render(
21
16
  <MemoryRouter>
22
17
  <BoundingBoxComponent bbox={boundingBox} />
23
18
  </MemoryRouter>,
24
19
  );
25
- expect(wrapper).toBeDefined();
20
+
21
+ expect(container).toBeDefined();
26
22
  });
27
23
  });
@@ -20,7 +20,7 @@ let store = mockStore({
20
20
  },
21
21
  search: {
22
22
  subrequest: {
23
- '123': { items: [] },
23
+ 123: { items: [] },
24
24
  },
25
25
  },
26
26
  users: {
@@ -97,6 +97,7 @@ describe('CLMSDatasetDetailView', () => {
97
97
  .toJSON();
98
98
  expect(DatasetDetailView).toBeDefined();
99
99
  });
100
+
100
101
  it('Check metadata view without downloadable files', () => {
101
102
  const content = {
102
103
  title: 'Test title!',
@@ -139,6 +140,7 @@ describe('CLMSDatasetDetailView', () => {
139
140
  .toJSON();
140
141
  expect(DatasetDetailView).toBeDefined();
141
142
  });
143
+
142
144
  it('Check metadata view with geonetwork_identifiers items lenght > 0 user roles exists and user roles includes manager', () => {
143
145
  const content = {
144
146
  geonetwork_identifiers: [
@@ -1,14 +1,11 @@
1
+ import { render } from '@testing-library/react';
1
2
  import ContactComponent from './ContactComponent';
2
3
  import React from 'react';
3
- import renderer from 'react-test-renderer';
4
4
  import { MemoryRouter } from 'react-router-dom';
5
5
 
6
- import Enzyme from 'enzyme';
7
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
8
- Enzyme.configure({ adapter: new Adapter() });
9
- //jest test for ContactComponent
6
+ // Jest test for ContactComponent
10
7
  describe('ContactComponent', () => {
11
- //test for ContactComponent rendering
8
+ // Test for ContactComponent rendering
12
9
  it('Check if ContactComponent is rendered', () => {
13
10
  const contact = {
14
11
  organisationName: 'Test',
@@ -22,13 +19,13 @@ describe('ContactComponent', () => {
22
19
  urlTitle: 'Test',
23
20
  roleCode: 'Test',
24
21
  };
25
- const contactComponent = renderer
26
- .create(
27
- <MemoryRouter>
28
- <ContactComponent contact={contact} />
29
- </MemoryRouter>,
30
- )
31
- .toJSON();
32
- expect(contactComponent).toBeDefined();
22
+
23
+ const { container } = render(
24
+ <MemoryRouter>
25
+ <ContactComponent contact={contact} />
26
+ </MemoryRouter>,
27
+ );
28
+
29
+ expect(container).toBeDefined();
33
30
  });
34
31
  });
@@ -1,24 +1,21 @@
1
- import Enzyme, { mount } from 'enzyme';
2
-
3
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
1
+ import { render } from '@testing-library/react';
4
2
  import DistributionInfoComponent from './DistributionInfoComponent';
5
3
  import { MemoryRouter } from 'react-router-dom';
6
4
  import React from 'react';
7
5
 
8
- Enzyme.configure({ adapter: new Adapter() });
9
- //jest test for DistributionInfoComponent
10
6
  describe('DistributionInfoComponent', () => {
11
- //test for DistributionInfoComponent rendering
12
7
  it('Check if DistributionInfoComponent is rendered', () => {
13
8
  const resource = {
14
9
  resourceLocator: 'http://example.com/resource',
15
10
  services: 'http://example.com/services',
16
11
  };
17
- const wrapper = mount(
12
+
13
+ const { container } = render(
18
14
  <MemoryRouter>
19
15
  <DistributionInfoComponent resource={resource} />
20
16
  </MemoryRouter>,
21
17
  );
22
- expect(wrapper).toBeDefined();
18
+
19
+ expect(container).toBeDefined();
23
20
  });
24
21
  });