Skip to content

Commit babfb32

Browse files
author
Iago Sardiña
committed
Test for valueResult in factComparison suite
1 parent 33eb4d2 commit babfb32

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/engine-fact-comparison.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,23 @@ describe('Engine: fact to fact comparison', () => {
118118
expect(eventSpy.callCount).to.equal(0)
119119
})
120120
})
121+
122+
context('constant facts: checking valueResult and factResult', () => {
123+
const constantCondition = {
124+
all: [{
125+
fact: 'height',
126+
operator: 'lessThanInclusive',
127+
value: {
128+
fact: 'width'
129+
}
130+
}]
131+
}
132+
it('result has the correct valueResult and factResult properties', async () => {
133+
setup(constantCondition)
134+
const result = await engine.run({ height: 1, width: 2 })
135+
136+
expect(result.results[0].conditions.all[0].factResult).to.equal(1)
137+
expect(result.results[0].conditions.all[0].valueResult).to.equal(2)
138+
})
139+
})
121140
})

0 commit comments

Comments
 (0)