Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Jun 12, 2023
2 parents 3c213ae + d55ba67 commit 905d9e4
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 5 deletions.
41 changes: 40 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [4.2.0](https://github.com/eea/volto-widgets-view/compare/4.1.0...4.2.0) - 25 April 2023
### [4.2.1](https://github.com/eea/volto-widgets-view/compare/4.2.0...4.2.1) - 12 June 2023

#### :rocket: New Features

- feat: Add unit tests for Widget - refs #253277 [Alin Voinea - [`86fadf8`](https://github.com/eea/volto-widgets-view/commit/86fadf8446068501363cd2d8037b606f57af4717)]
- feat:add unit tests for Widget -refs #253277 [ana-oprea - [`94105cc`](https://github.com/eea/volto-widgets-view/commit/94105cc082c43e7735dbec0fc8bc3286f3203f92)]

#### :house: Internal changes

- chore: [Jenkins] fix paths in report [valentinab25 - [`983fe70`](https://github.com/eea/volto-widgets-view/commit/983fe70cd024c84b73aaedcd4850db9c19916a80)]
- chore: [JENKINS] add debug [valentinab25 - [`1cc68b0`](https://github.com/eea/volto-widgets-view/commit/1cc68b0815a71f4fbd23255efbbe1cb11f9298b0)]

#### :hammer_and_wrench: Others

- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`c9f9d0f`](https://github.com/eea/volto-widgets-view/commit/c9f9d0ff6e4950f44f4376d8d259060453cf735b)]
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`4378251`](https://github.com/eea/volto-widgets-view/commit/437825180366598eda148e08550ffaad6b419241)]
- tests: [JENKINS] remove debug [valentinab25 - [`4cdaea7`](https://github.com/eea/volto-widgets-view/commit/4cdaea78b07edabf6a38fa5c4ed74d7b275041c4)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`68dd809`](https://github.com/eea/volto-widgets-view/commit/68dd8095281e954d9c0b7daede0620884666c9d0)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`38dbece`](https://github.com/eea/volto-widgets-view/commit/38dbece6becad0cde22753d913ff5b5637479ca6)]
### [4.2.0](https://github.com/eea/volto-widgets-view/compare/4.1.0...4.2.0) - 26 April 2023

#### :rocket: New Features

Expand All @@ -16,11 +35,18 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`aec82fb`](https://github.com/eea/volto-widgets-view/commit/aec82fbbc2b2ec0af5f305e3091ee1c6339be827)]
### [4.1.0](https://github.com/eea/volto-widgets-view/compare/4.0.1...4.1.0) - 27 March 2023

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5a01e0d`](https://github.com/eea/volto-widgets-view/commit/5a01e0d6a66f6e4622fe5372290645c8a88f849c)]
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`72e9a45`](https://github.com/eea/volto-widgets-view/commit/72e9a458e81805ca2b5975748cdbd75a516370bb)]
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`589dafd`](https://github.com/eea/volto-widgets-view/commit/589dafda3414704dac851c5d6983a64c5e57f813)]
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`3771315`](https://github.com/eea/volto-widgets-view/commit/377131511ec4621834562fcba79e33b5cd237eb9)]
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`b36230f`](https://github.com/eea/volto-widgets-view/commit/b36230f3ddcce8cd22c0170bfc85330bc36858d7)]
- yarn 3 [Alin Voinea - [`3cc8ed7`](https://github.com/eea/volto-widgets-view/commit/3cc8ed748ce6f888064392d5d1af0071866fc736)]
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`5373246`](https://github.com/eea/volto-widgets-view/commit/5373246dd245e5d38330b482f12ce9080cd1b2c4)]
### [4.0.1](https://github.com/eea/volto-widgets-view/compare/4.0.0...4.0.1) - 16 November 2022

#### :hammer_and_wrench: Others
Expand All @@ -32,34 +58,47 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- Typo [Miu Razvan - [`c123633`](https://github.com/eea/volto-widgets-view/commit/c123633c0d4a9d72dcd76f24cbc3042ed0222575)]
- Prepare 4.0.0 release [Miu Razvan - [`f8f9998`](https://github.com/eea/volto-widgets-view/commit/f8f9998d471a81b814d650bd56f1e25bb6b6626b)]
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`0e0c45d`](https://github.com/eea/volto-widgets-view/commit/0e0c45d96cb880b979f9048f721ec4a6ee7ff890)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`1ca6e8b`](https://github.com/eea/volto-widgets-view/commit/1ca6e8b06655717caa73777ec10a2b7ba7c3ee3b)]
- update(jest): add @plone/volto-slate resolver refs- #153447 [nileshgulia1 - [`7620cbb`](https://github.com/eea/volto-widgets-view/commit/7620cbbe00279f1e31bc5356dfb33d32714f187a)]
### [3.0.5](https://github.com/eea/volto-widgets-view/compare/3.0.4...3.0.5) - 30 June 2022

#### :hammer_and_wrench: Others

- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`44e5140`](https://github.com/eea/volto-widgets-view/commit/44e5140b561f15d2a2f776e0d6e2795ebfed6d24)]
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`8e15565`](https://github.com/eea/volto-widgets-view/commit/8e15565eb071ad28097599c2f22db18853fe71c5)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`045318e`](https://github.com/eea/volto-widgets-view/commit/045318e2bd2a5ebb4a6fac2c08a3aaa01ad98131)]
### [3.0.4](https://github.com/eea/volto-widgets-view/compare/3.0.3...3.0.4) - 3 January 2022

### [3.0.3](https://github.com/eea/volto-widgets-view/compare/3.0.2...3.0.3) - 18 December 2021

#### :hammer_and_wrench: Others

- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`d546460`](https://github.com/eea/volto-widgets-view/commit/d5464603838564bb1020ee79f3b0fd005be8e68d)]
### [3.0.2](https://github.com/eea/volto-widgets-view/compare/3.0.1...3.0.2) - 10 December 2021

#### :hammer_and_wrench: Others

- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`1820d1b`](https://github.com/eea/volto-widgets-view/commit/1820d1b968813be6510243468dd6df430a8655d1)]
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`c5bb4d0`](https://github.com/eea/volto-widgets-view/commit/c5bb4d03399609d3fa96e6a2124d82141d52b9b1)]
### [3.0.1](https://github.com/eea/volto-widgets-view/compare/3.0.0...3.0.1) - 19 October 2021

#### :hammer_and_wrench: Others

- Add date locale config settings [Alin Voinea - [`f425e19`](https://github.com/eea/volto-widgets-view/commit/f425e1980697f519cd8b0a26ae6945fbcbfc821d)]
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`a839312`](https://github.com/eea/volto-widgets-view/commit/a8393128bdfaac7375c9779553196ae83215cca9)]
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`b59f8af`](https://github.com/eea/volto-widgets-view/commit/b59f8afa65098f622805b62ab0d4aaf2b5a7376c)]
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`000cdcf`](https://github.com/eea/volto-widgets-view/commit/000cdcf47d18a3b47e0aac11376796daa8de730b)]
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`71f0633`](https://github.com/eea/volto-widgets-view/commit/71f0633a04d5aac5aa9cb0c5ad33ebccfe3dddd7)]
## [3.0.0](https://github.com/eea/volto-widgets-view/compare/2.1.2...3.0.0) - 3 September 2021

#### :hammer_and_wrench: Others

- Code cleanup [Alin Voinea - [`2becdc5`](https://github.com/eea/volto-widgets-view/commit/2becdc5a196edaa9db8d1741cd7752fdac39013f)]
- Release 3.0.0 [Alin Voinea - [`95a63b3`](https://github.com/eea/volto-widgets-view/commit/95a63b3745100fe1bf59bf6e63258554d2685239)]
- Fix config.widgets.views in order to be able to register views from other add-ons [Alin Voinea - [`1c01da9`](https://github.com/eea/volto-widgets-view/commit/1c01da963a43339422019ab2a07ec46db1abed82)]
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`8274ffb`](https://github.com/eea/volto-widgets-view/commit/8274ffb7e96066c21680b2addfcd131a52aaa461)]
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`852108b`](https://github.com/eea/volto-widgets-view/commit/852108bf32a2e16e0f1212f993a2c467ada89a69)]
### [2.1.2](https://github.com/eea/volto-widgets-view/compare/2.1.1...2.1.2) - 27 May 2021

### [2.1.1](https://github.com/eea/volto-widgets-view/compare/2.1.0...2.1.1) - 14 May 2021
Expand Down
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
environment {
GIT_NAME = "volto-widgets-view"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
DEPENDENCIES = ""
VOLTO = ""
}
Expand Down Expand Up @@ -188,6 +188,7 @@ pipeline {
def nodeJS = tool 'NodeJS';
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
Expand Down
4 changes: 2 additions & 2 deletions jest-addon.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ module.exports = {
'!src/**/*.d.ts',
],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@package/(.*)$': '<rootDir>/src/$1',
'@root/(.*)$': '<rootDir>/src/$1',
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
'@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
'@plone/volto-slate':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
'~/(.*)$': '<rootDir>/src/$1',
'load-volto-addons':
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
transform: {
'^.+\\.js(x)?$': 'babel-jest',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-widgets-view",
"version": "4.2.0",
"version": "4.2.1",
"description": "Volto Widgets in View mode",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
77 changes: 77 additions & 0 deletions src/helpers/Widget.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { getWidgetView } from './Widget';

jest.mock('@plone/volto/registry', () => ({
widgets: {
views: {
id: {
fieldId1: 'Widget1',
fieldId2: 'Widget2',
},
widget: {
widgetName1: 'Widget3',
widgetName2: 'Widget4',
},
vocabulary: {
vocabulary1: 'Widget5',
vocabulary2: 'Widget6',
},
choices: 'Widget7',
type: {
type1: 'Widget8',
type2: 'Widget9',
},
default: 'Widget10',
},
},
settings: {
apiPath: '/api',
},
}));

describe('getWidgetView', () => {
it('should return the widget component based on field id', () => {
const props = { id: 'fieldId1' };
const result = getWidgetView(props);
expect(result).toBe('Widget1');
});

it('should return the widget component based on widget name', () => {
const props = { widget: 'widgetName2' };
const result = getWidgetView(props);
expect(result).toBe('Widget4');
});

it('should return the widget component based on choices prop', () => {
const props = { choices: true };
const result = getWidgetView(props);
expect(result).toBe('Widget7');
});

it('should return the widget component based on vocabulary prop', () => {
const props = { vocabulary: { '@id': '/api/@vocabularies/vocabulary2' } };
const result = getWidgetView(props);
expect(result).toBe('Widget7');
});

it('should return the widget component based on widgetOptions vocabulary hint', () => {
const props = {
widgetOptions: {
vocabulary: { '@id': '/api/@vocabularies/vocabulary1' },
},
};
const result = getWidgetView(props);
expect(result).toBe('Widget5');
});

it('should return the widget component based on type', () => {
const props = { type: 'type2' };
const result = getWidgetView(props);
expect(result).toBe('Widget9');
});

it('should return the default widget component', () => {
const props = {};
const result = getWidgetView(props);
expect(result).toBe('Widget10');
});
});

0 comments on commit 905d9e4

Please sign in to comment.