1er test de la librairie

pull/386/head
Mael 2018-08-16 10:09:20 +02:00
parent 42e1500bcf
commit 0fcb6bd5a3
2 changed files with 20 additions and 5 deletions

View File

@ -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",

16
test/library.test.js Normal file
View File

@ -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)
})
})