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

Function setup

test/engine-fact-priority.test.js:23–38  ·  view source on GitHub ↗
(conditions)

Source from the content-addressed store, hash-verified

21 let accountTypeStub
22
23 function setup (conditions) {
24 ageStub = sandbox.stub()
25 segmentStub = sandbox.stub()
26 accountTypeStub = sandbox.stub()
27 eventSpy = sandbox.stub()
28 failureSpy = sandbox.stub()
29
30 engine = engineFactory()
31 const rule = factories.rule({ conditions, event })
32 engine.addRule(rule)
33 engine.addFact('age', ageStub, { priority: 100 })
34 engine.addFact('segment', segmentStub, { priority: 50 })
35 engine.addFact('accountType', accountTypeStub, { priority: 25 })
36 engine.on('success', eventSpy)
37 engine.on('failure', failureSpy)
38 }
39
40 describe('all conditions', () => {
41 const allCondition = {

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…