From 11c64e76544b11c2991e509a6b16ddda832ded82 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 17 Oct 2018 13:52:32 +0000 Subject: [PATCH] =?UTF-8?q?:sparkles:=20R=C3=A9solution=20de=20petits=20pr?= =?UTF-8?q?obl=C3=A8mes=20divers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/engine/index.js | 2 +- source/règles/base.yaml | 2 +- test/library.test.js | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/source/engine/index.js b/source/engine/index.js index c33933ed5..6c2cdd63e 100644 --- a/source/engine/index.js +++ b/source/engine/index.js @@ -35,7 +35,7 @@ export default { Array.isArray(targetInput) ? targetInput : [targetInput] )(nestedSituationToStateSelector(rules)(nestedSituation)) - if (config.debug) return evaluation + if (config?.debug) return evaluation let values = evaluation.targets.map(t => t.nodeValue) diff --git a/source/règles/base.yaml b/source/règles/base.yaml index 47518049a..04b210bd2 100644 --- a/source/règles/base.yaml +++ b/source/règles/base.yaml @@ -734,7 +734,7 @@ - si: brut de base < 300 message: Entrez un salaire raisonnable niveau: bloquant - - si: brut de base < SMIC mensuel + - si: brut de base < SMIC niveau: avertissement solution: cible: contrat salarié . temps partiel diff --git a/test/library.test.js b/test/library.test.js index b3fcf7b3b..aa45cc2e2 100644 --- a/test/library.test.js +++ b/test/library.test.js @@ -1,6 +1,5 @@ import { expect } from 'chai' import Syso from '../source/engine/index' -import { propEq } from 'ramda' import sasuRules from '../source/règles/sasu.yaml' describe('library', function() { @@ -76,7 +75,7 @@ describe('library', function() { console.log({ revenuDisponible, dividendes }) }) - it('temp', function() { + it('should let the user define a simplified revenue tax system', function() { let règles = ` - nom: revenu imposable question: Quel est votre revenu imposable ? @@ -123,10 +122,8 @@ describe('library', function() { let value = Syso.evaluate( target, { 'revenu imposable': '48000' }, - { extra: règles } + { base: règles } ) - console.log(value) - - expect(value).to.equal(7000) + expect(value).to.equal(7253.26) }) })