 
   it 'should parse multiple frames delivered in partials', ->
     frameBuffer = new FrameBuffer()
-    first = createFrame message.FRAME_TYPE_RESPONSE, 'OK'
-    second = createFrame message.FRAME_TYPE_RESPONSE, '{}'
+    first = createFrame wire.FRAME_TYPE_RESPONSE, 'OK'
+    second = createFrame wire.FRAME_TYPE_RESPONSE, '{}'
     data = Buffer.concat [first, second]
 
     # First frame is 10 bytes long. Don't expect to get anything back.

chai.use sinonChai 

FrameBuffer = require '../lib/framebuffer.coffee'
message = require '../lib/message'

createFrame = (frameId, payload) ->
  frame = new Buffer(4 + 4 + payload.length)


  it 'empty internal buffer when all frames are consumed', ->
    frameBuffer = new FrameBuffer()
    data = createFrame wire.FRAME_TYPE_RESPONSE, 'OK'
    
    frame = frameBuffer.consume data
    expect(frameBuffer._buffer).to.be.null
