diff --git a/package.json b/package.json index 9a535cb60..ab14e62c4 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,7 @@ "engines": { "node": ">=8.10.0 <10.0.0" }, - "browserslist": [ - "> 1% in FR", - "not ie < 11" - ], + "browserslist": ["> 1% in FR", "not ie < 11"], "dependencies": { "@researchgate/react-intersection-observer": "^0.7.3", "classnames": "^2.2.5", @@ -67,7 +64,9 @@ "test-watch": "yarn test-common --watch", "test-common": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require mock-local-storage --require test/helpers/browser.js \"./{,!(node_modules)/**/}!(webpack).test.js\"", "test": "yarn test-common", - "test-components": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require mock-local-storage ---require test/helpers/browser.js \"source/components/**/*.test.js\" --watch" + "test-components": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require mock-local-storage ---require test/helpers/browser.js \"source/components/**/*.test.js\" --watch", + "test-lib": + "yarn test-common --grep 'library'" }, "devDependencies": { "@babel/core": "^7.1.0", diff --git a/test/library.test.js b/test/library.test.js new file mode 100644 index 000000000..02fee93df --- /dev/null +++ b/test/library.test.js @@ -0,0 +1,16 @@ +import { expect } from 'chai' +import evaluate from '../source/engine/index' +import { propEq } from 'ramda' + +describe('library', function() { + it('should evaluate one target with no input data', function() { + let target = 'contrat salariƩ . salaire . net' + let evaluated = evaluate([target], { + 'contrat salariƩ': { salaire: { 'brut de base': 2300 } } + }) + let evaluatedTarget = evaluated.targets.find(propEq('dottedName', target)) + expect(evaluatedTarget) + .to.have.property('nodeValue') + .to.be.within(1779, 1780) + }) +})