Utiliser les sélecteurs avec n'importe quelles règles

pull/256/head
Mael 2018-06-15 11:55:53 +02:00
parent c0e5cc76e3
commit 4eb26d7ffb
2 changed files with 6 additions and 7 deletions

View File

@ -11,8 +11,8 @@ import { head, isEmpty, pick } from 'ramda'
import { getFormValues } from 'redux-form'
import {
collectDefaults,
rules,
rulesFr,
rules as baseRulesEn,
rulesFr as baseRulesFr,
nestedSituationToPathMap,
formatInputs,
findRuleByDottedName,
@ -26,11 +26,10 @@ import {
*
* */
let langSelector = state => state.lang
export let flatRulesSelector = createSelector(
[langSelector],
lang => (lang === 'en' ? rules : rulesFr)
state => state.lang,
state => state.rules,
(lang, rules) => rules || (lang === 'en' ? baseRulesEn : baseRulesFr)
)
let parsedRulesSelector = createSelector([flatRulesSelector], rules =>

View File

@ -10,7 +10,7 @@ import { analyse, parseAll } from '../source/engine/traverse'
import { collectMissingVariables } from '../source/engine/generateQuestions'
import testSuites from './load-mecanism-tests'
import * as R from 'ramda'
import { isFloat } from '../source/components/rule/Examples'
import { isFloat } from '../source/utils'
describe('Mécanismes', () =>
testSuites.map(suite =>