From e79e71fb2261848bb8e96b68535c6e1e5af59981 Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 11 Feb 2019 14:44:24 +0100 Subject: [PATCH] =?UTF-8?q?:white=5Fcheck=5Fmark:=20R=C3=A9paration=20des?= =?UTF-8?q?=20tests=20de=20bar=C3=A8me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Et réactivation de tous les tests, malencontreusement désactivés par un it.only... --- source/components/rule/Algorithm.js | 44 ++++++++++++++--------------- test/library.test.js | 11 ++++---- test/mécanismes/barème-continu.yaml | 30 ++++++++++++++------ 3 files changed, 47 insertions(+), 38 deletions(-) diff --git a/source/components/rule/Algorithm.js b/source/components/rule/Algorithm.js index dd01c3030..3a62434fb 100644 --- a/source/components/rule/Algorithm.js +++ b/source/components/rule/Algorithm.js @@ -1,11 +1,11 @@ -import classNames from 'classnames'; -import { makeJsx } from 'Engine/evaluation'; -import { any, compose, identity, path } from 'ramda'; -import React from 'react'; -import { Trans, withTranslation } from 'react-i18next'; -import './Algorithm.css'; +import classNames from 'classnames' +import { makeJsx } from 'Engine/evaluation' +import { any, compose, identity, path } from 'ramda' +import React from 'react' +import { Trans, withTranslation } from 'react-i18next' +import './Algorithm.css' // The showValues prop is passed as a context. It used to be delt in CSS (not(.showValues) display: none), both coexist right now -import { ShowValuesProvider } from './ShowValuesContext'; +import { ShowValuesProvider } from './ShowValuesContext' let Conditions = ({ parentDependency, @@ -35,27 +35,25 @@ export default compose(withTranslation())( render() { let { rule, showValues } = this.props let formula = - rule['formule'] || - (rule.category === 'variable' && rule.explanation.formule), - displayFormula = - formula && !!Object.keys(formula).length && - !path(['formule', 'explanation', 'une possibilité'], rule) - console.log(rule.dottedName, formula, displayFormula) + rule['formule'] || + (rule.category === 'variable' && rule.explanation.formule), + displayFormula = + formula && + !!Object.keys(formula).length && + !path(['formule', 'explanation', 'une possibilité'], rule) return (
- { - displayFormula && ( -
-

- Calcul -

- {makeJsx(formula)} -
- ) - } + {displayFormula && ( +
+

+ Calcul +

+ {makeJsx(formula)} +
+ )}
diff --git a/test/library.test.js b/test/library.test.js index 80f823c66..50867d8de 100644 --- a/test/library.test.js +++ b/test/library.test.js @@ -1,7 +1,7 @@ -import { expect } from 'chai'; -import Syso from '../source/engine/index'; -import co2 from '../source/règles/co2.yaml'; -import sasuRules from '../source/règles/sasu.yaml'; +import { expect } from 'chai' +import Syso from '../source/engine/index' +import co2 from '../source/règles/co2.yaml' +import sasuRules from '../source/règles/sasu.yaml' describe('library', function() { it('should evaluate one target with no input data', function() { @@ -46,7 +46,7 @@ describe('library', function() { expect(value).to.be.closeTo(1799, 1) }) - it.only('should let the user extend the rules constellation in a serious manner', function() { + it('should let the user extend the rules constellation in a serious manner', function() { let CA = 550 * 16 let salaireTotal = Syso.evaluate( 'salaire total', @@ -63,7 +63,6 @@ describe('library', function() { } ) - let [revenuDisponible, dividendes] = Syso.evaluate( ['revenu disponible', 'dividendes . net'], { diff --git a/test/mécanismes/barème-continu.yaml b/test/mécanismes/barème-continu.yaml index 965368a4f..0166b1794 100644 --- a/test/mécanismes/barème-continu.yaml +++ b/test/mécanismes/barème-continu.yaml @@ -16,11 +16,11 @@ 1.1: 6.35% exemples: - - nom: Premier intervale + - nom: Premier point situation: assiette: 10 valeur attendue: 0.026 - - nom: Deuxième intervale + - nom: Deuxième point situation: assiette: 120 valeur attendue: 3.792 @@ -28,7 +28,7 @@ situation: assiette: 150 valeur attendue: 5.423 - - nom: Deuxième point + - nom: Troisième point situation: assiette: 330 valeur attendue: 20.955 @@ -56,11 +56,23 @@ 1: 0% retourne seulement le taux: oui exemples: - - nom: Premier intervale + - nom: Premier point situation: - assiette deux: 10 - valeur attendue: 0.026 - - nom: Deuxième intervale + assiette deux: 200 + valeur attendue: 1 + - nom: Deuxième point situation: - assiette deux: 120 - valeur attendue: 3.792 + assiette deux: 225 + valeur attendue: 1 + - nom: Troisième point + situation: + assiette deux: 262.5 + valeur attendue: 0.5 + - nom: Quatrième point + situation: + assiette deux: 300 + valeur attendue: 0 + - nom: Cinquième point + situation: + assiette deux: 300 + valeur attendue: 0