meshblu-rules-engine
Version:
Rules for transforming devices in Meshblu based off of events
51 lines (40 loc) • 1.28 kB
text/coffeescript
MeshbluRulesEngine = require '../src/models/meshblu-rules-engine'
IfElseConfig = require '../rules/if-else.cson'
describe 'If/Else', ->
beforeEach ->
= new MeshbluRulesEngine rulesConfig: IfElseConfig
describe 'when the first and second conditions are true', ->
beforeEach (done) ->
data =
president: 'HUGH'
spy: 0x007
.run {data}, (error, ) =>
done error
it 'should return results', ->
expect(.events).to.deep.equal [
type: "info"
params:
text: "small hands"
]
describe 'when the first condition is false and the second is true', ->
beforeEach (done) ->
data =
president: 'tiny'
spy: 0x007
.run {data}, (error, ) =>
done error
it 'should return proper results', ->
expect(.events).to.deep.equal [
type: "info"
params:
text: "send in the TLAs"
]
describe 'when the first and second conditions are false', ->
beforeEach (done) ->
data =
president: 'tiny'
notSpy: 0x007
.run {data}, (error, ) =>
done error
it 'should return no results', ->
expect(.events).to.deep.equal []