1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Fix major oversight in MessageStream that was causing multi-chunk messages to fail.

This commit is contained in:
Simo Kinnunen 2014-04-01 17:54:31 +09:00
parent 09eb8c539d
commit 2bf8f2352b
2 changed files with 29 additions and 27 deletions

View file

@ -21,11 +21,15 @@ describe('MessageStream', function() {
var ds = new ms.DelimitedStream()
var spy = sinon.spy()
ds.on('data', spy)
ds.write(new Buffer([1]))
ds.write(new Buffer([3]))
expect(spy).to.not.have.been.called
ds.write(new Buffer([0x66]))
expect(spy).to.not.have.been.called
ds.write(new Buffer([0x65]))
expect(spy).to.not.have.been.called
ds.write(new Buffer([0x64]))
expect(spy).to.have.been.calledOnce
expect(spy.firstCall.args).to.eql([new Buffer([0x66])])
expect(spy.firstCall.args).to.eql([new Buffer([0x66, 0x65, 0x64])])
})
it('should read varint32 properly', function() {