meshblu-connector-skype
Version:
71 lines (57 loc) • 2.02 kB
text/coffeescript
{sinon, describe, it, expect, beforeEach} = global
MessageToState = require '..'
describe 'when we create a new MessageToState', ->
beforeEach 'setup state manager', ->
= {
start: sinon.stub()
onConfig: sinon.stub()
on: sinon.stub()
}
beforeEach ->
= new MessageToState { }
it 'should exist', ->
expect().to.exist
describe 'when start is called', ->
beforeEach 'start()', ->
= ->
.start
it 'should call start on stateManager with an empty device and a callback', ->
expect(.start).to.have.been.calledWith {autoLaunchSkype: true},
describe 'when called with a start-skype message', ->
beforeEach ->
startSkypeMessage =
metadata:
type: 'message'
data:
metadata:
jobType: 'start-skype'
.onMessage startSkypeMessage
it 'should call onConfig on the stateManager with the correct desiredState', ->
state =
desiredState:
videoEnabled: true
audioEnabled: true
meeting:
url: null
autoLaunchSkype: true
expect(.onConfig).to.have.been.calledWith state
describe 'when called with an end-skype message', ->
beforeEach ->
startSkypeMessage =
metadata:
type: 'message'
data:
metadata:
jobType: 'end-skype'
.onMessage startSkypeMessage
it 'should call onConfig on the stateManager with the correct desiredState', ->
state =
desiredState: meeting: null
autoLaunchSkype: true
expect(.onConfig).to.have.been.calledWith state
describe 'when autoLaunchSkype is called', ->
beforeEach ->
.autoLaunchSkype()
it 'should call onConfig on the stateManager with the correct desiredState', ->
state = autoLaunchSkype: true
expect(.onConfig).to.have.been.calledWith state