Utiliser les sélecteurs avec n'importe quelles règles
parent
c0e5cc76e3
commit
4eb26d7ffb
|
@ -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 =>
|
||||
|
|
|
@ -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 =>
|
||||
|
|
Loading…
Reference in New Issue