Réparation des tests de barème

Et réactivation de tous les tests, malencontreusement désactivés par un
it.only...
pull/456/head
Mael 2019-02-11 14:44:24 +01:00
parent 5d691a5ce5
commit e79e71fb22
3 changed files with 47 additions and 38 deletions

View File

@ -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 (
<div id="algorithm">
<section id="rule-rules" className={classNames({ showValues })}>
<ShowValuesProvider value={showValues}>
<Conditions {...rule} />
{
displayFormula && (
<section id="formule">
<h2>
<Trans>Calcul</Trans>
</h2>
{makeJsx(formula)}
</section>
)
}
{displayFormula && (
<section id="formule">
<h2>
<Trans>Calcul</Trans>
</h2>
{makeJsx(formula)}
</section>
)}
</ShowValuesProvider>
</section>
</div>

View File

@ -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'],
{

View File

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