(conditions = baseConditions)
| 31 | } |
| 32 | let eventSpy |
| 33 | function setup (conditions = baseConditions) { |
| 34 | eventSpy = sandbox.spy() |
| 35 | const engine = engineFactory() |
| 36 | const rule = factories.rule({ conditions, event }) |
| 37 | engine.addRule(rule) |
| 38 | engine.addOperator('startsWithLetter', (factValue, jsonValue) => { |
| 39 | if (!factValue.length) return false |
| 40 | return factValue[0].toLowerCase() === jsonValue.toLowerCase() |
| 41 | }) |
| 42 | engine.addFact('dictionary', dictionary) |
| 43 | engine.on('success', eventSpy) |
| 44 | return engine |
| 45 | } |
| 46 | |
| 47 | describe('evaluation', () => { |
| 48 | it('emits when the condition is met', async () => { |
no test coverage detected
searching dependent graphs…