From 0fcb6bd5a3089efac445cd80937750a2505e0a25 Mon Sep 17 00:00:00 2001 From: Mael Date: Thu, 16 Aug 2018 10:09:20 +0200 Subject: [PATCH] :white_check_mark: 1er test de la librairie --- package.json | 9 ++++----- test/library.test.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 test/library.test.js 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) + }) +})