()
| 26 | }) |
| 27 | |
| 28 | function setup () { |
| 29 | const factSpy = sandbox.stub().returns(22) |
| 30 | const eventSpy = sandbox.spy() |
| 31 | engine = engineFactory() |
| 32 | |
| 33 | const highPriorityRule = factories.rule({ conditions, event: midPriorityEvent, priority: 50 }) |
| 34 | engine.addRule(highPriorityRule) |
| 35 | |
| 36 | const midPriorityRule = factories.rule({ conditions, event: highPriorityEvent, priority: 100 }) |
| 37 | engine.addRule(midPriorityRule) |
| 38 | |
| 39 | const lowPriorityRule = factories.rule({ conditions, event: lowestPriorityEvent, priority: 1 }) |
| 40 | engine.addRule(lowPriorityRule) |
| 41 | |
| 42 | engine.addFact('age', factSpy) |
| 43 | engine.on('success', eventSpy) |
| 44 | } |
| 45 | |
| 46 | it('runs the rules in order of priority', () => { |
| 47 | setup() |
no test coverage detected
searching dependent graphs…