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

Function setup

test/engine-cache.test.js:32–44  ·  view source on GitHub ↗
(factOptions)

Source from the content-addressed store, hash-verified

30 return 22
31 }
32 function setup (factOptions) {
33 factSpy = sandbox.spy()
34 eventSpy = sandbox.spy()
35 engine = engineFactory()
36 const determineDrinkingAge = factories.rule({ conditions, event, priority: 100 })
37 engine.addRule(determineDrinkingAge)
38 const determineCollegeSenior = factories.rule({ conditions, event: collegeSeniorEvent, priority: 1 })
39 engine.addRule(determineCollegeSenior)
40 const over20 = factories.rule({ conditions, event: collegeSeniorEvent, priority: 50 })
41 engine.addRule(over20)
42 engine.addFact('age', ageFact, factOptions)
43 engine.on('success', eventSpy)
44 }
45
46 it('loads facts once and caches the results for future use', async () => {
47 setup({ cache: true })

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…