MCPcopy
hub / github.com/CacheControl/json-rules-engine / setup

Function setup

test/engine-controls.test.js:21–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 let segmentStub
20
21 function setup () {
22 ageStub = sandbox.stub()
23 segmentStub = sandbox.stub()
24 eventSpy = sandbox.stub()
25 engine = engineFactory()
26
27 let conditions = {
28 any: [{
29 fact: 'age',
30 operator: 'greaterThanInclusive',
31 value: 18
32 }]
33 }
34 let rule = factories.rule({ conditions, event, priority: 100 })
35 engine.addRule(rule)
36
37 conditions = {
38 any: [{
39 fact: 'segment',
40 operator: 'equal',
41 value: 'human'
42 }]
43 }
44 rule = factories.rule({ conditions, event })
45 engine.addRule(rule)
46
47 engine.addFact('age', ageStub, { priority: 100 })
48 engine.addFact('segment', segmentStub, { priority: 50 })
49 }
50
51 describe('stop()', () => {
52 it('stops the rules from executing', async () => {

Callers 1

Calls 2

addRuleMethod · 0.80
addFactMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…