Tester la logique n-conditions, corriger l'aiguillage, supprimer le warning https://fb.me/react-warning-keys

pull/14/head
Laurent Bossavit 2017-06-28 00:38:55 +02:00
parent a7d5f3dc55
commit 9b427690ec
2 changed files with 14 additions and 3 deletions

View File

@ -61,3 +61,14 @@ describe('analyseSituation on raw rules', function() {
*/
});
describe('analyseSituation with mecanisms', function() {
it('should handle n-way "or"', function() {
let rawRules = [
{nom: "startHere", formule: {"une de ces conditions": ["1 > 2", "1 > 0", "0 > 2"]}}],
rules = rawRules.map(enrichRule)
expect(analyseSituation(rules,"startHere")(stateSelector)).to.have.property('nodeValue',true)
});
});

View File

@ -286,7 +286,7 @@ let treat = (situationGate, rules, rule) => rawNode => {
value={result.nodeValue}
child={
<ul>
{result.explanation.map(item => <li key={item.name}>{item.jsx}</li>)}
{result.explanation.map(item => <li key={item.name || item.text}>{item.jsx}</li>)}
</ul>
}
/>
@ -713,8 +713,8 @@ let treat = (situationGate, rules, rule) => rawNode => {
let onNodeType = R.cond([
[R.is(String), treatString],
[R.is(Number), treatNumber],
[!R.is(Object), treatOther],
[R.T, treatObject]
[R.is(Object), treatObject],
[R.T, treatOther]
])
return onNodeType(rawNode)
}