       it 'requires a DOM Node', ->
         fn = -> CineIO.publish("FAKE_STREAM_ID", "FAKE_PASSWORD")
         expect(fn).to.throw(Error, "DOM node required.")
+      describe 'success', ->
+        beforeEach ->
+          @publishStub = sinon.stub PublishStream, 'new'
+
+        afterEach ->
+          @publishStub.restore()
+
+        it 'calls to PublishStream', ->
+          CineIO.publish("FAKE_STREAM_ID", 'FAKE_PASSWORD', 'fake-dom-id')
+          expect(@publishStub.calledOnce).to.be.true
+          args = @publishStub.firstCall.args
+          expect(args).to.deep.equal(["FAKE_STREAM_ID", 'FAKE_PASSWORD', 'fake-dom-id', {}])
 
   describe '.play', ->
     requiresInit('play')

CineIO = require('../src/main')

describe 'CineIO', ->


        fn = -> CineIO.playRecording("FAKE_STREAM_ID", "FAKE_RECORDING_NAME")
        expect(fn).to.throw(Error, "DOM node required.")

      describe 'success', ->
        beforeEach ->
          @playRecordingStub = sinon.stub PlayStream, 'recording'

        afterEach ->
          @playRecordingStub.restore()

        it 'calls to PlayStream', ->
          CineIO.playRecording("FAKE_STREAM_ID", 'fakeRecording.mp4', 'fake-dom-id')
          expect(@playRecordingStub.calledOnce).to.be.true
          args = @playRecordingStub.firstCall.args
          expect(args).to.deep.equal(["FAKE_STREAM_ID", 'fakeRecording.mp4', 'fake-dom-id', {}])

  describe '.getStreamDetails', ->
    requiresInit('getStreamDetails')
    describe 'after initialized', ->
      initCineIO()
      requiresStreamId('getStreamDetails')

      describe 'success', ->
        beforeEach ->
          @getStreamDetailsStub = sinon.stub ApiBridge, 'getStreamDetails'

        afterEach ->
          @getStreamDetailsStub.restore()

        it 'calls to the ApiBridge', ->
          CineIO.getStreamDetails("FAKE_STREAM_ID", "the callback")
          expect(@getStreamDetailsStub.calledOnce).to.be.true
          args = @getStreamDetailsStub.firstCall.args
          expect(args).to.deep.equal(["FAKE_STREAM_ID", 'the callback'])

  describe '.getStreamRecordings', ->
    requiresInit('getStreamRecordings')
    describe 'after initialized', ->
      initCineIO()
      requiresStreamId('getStreamRecordings')

      describe 'success', ->
        beforeEach ->
          @getStreamRecordingsStub = sinon.stub ApiBridge, 'getStreamRecordings'

        afterEach ->
          @getStreamRecordingsStub.restore()

        it 'calls to the ApiBridge', ->
          CineIO.getStreamRecordings("FAKE_STREAM_ID", "the callback")
          expect(@getStreamRecordingsStub.calledOnce).to.be.true
          args = @getStreamRecordingsStub.firstCall.args
          expect(args).to.deep.equal(["FAKE_STREAM_ID", 'the callback'])
