mon-entreprise/test/rules.test.js

26 lines
927 B
JavaScript
Raw Normal View History

import R from 'ramda'
import {expect} from 'chai'
import {rules, enrichRule, findVariantsAndRecords} from '../source/engine/rules'
import {analyseSituation, analyseTopDown} from '../source/engine/traverse'
let stateSelector = (state, name) => null
describe('enrichRule', function() {
it('should extract the type of the rule', function() {
let rule = {cotisation:{}}
expect(enrichRule(rule)).to.have.property('type','cotisation')
});
it('should extract the dotted name of the rule', function() {
let rule = {espace:"contrat salarié", nom: "CDD"}
expect(enrichRule(rule)).to.have.property('name','CDD')
expect(enrichRule(rule)).to.have.property('dottedName','contrat salarié . CDD')
});
it('should render Markdown in sub-questions', function() {
let rule = {"sous-question":"**wut**"}
expect(enrichRule(rule)).to.have.property('subquestion','<p><strong>wut</strong></p>\n')
});
});