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

Function setup

test/engine-operator.test.js:33–45  ·  view source on GitHub ↗
(conditions = baseConditions)

Source from the content-addressed store, hash-verified

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 () => {

Callers 1

Calls 3

addRuleMethod · 0.80
addOperatorMethod · 0.80
addFactMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…