@@ -43,6 +43,19 @@ describe('MqttClient', function () {
4343 done ( )
4444 }
4545 } )
46+
47+ it ( 'should disable number cache if specified in options' , function ( done ) {
48+ try {
49+ assert . isTrue ( mqttPacket . writeToStream . cacheNumbers )
50+ client = mqtt . MqttClient ( function ( ) {
51+ throw Error ( 'break' )
52+ } , { writeCache : false } )
53+ client . end ( )
54+ } catch ( err ) {
55+ assert . isFalse ( mqttPacket . writeToStream . cacheNumbers )
56+ done ( )
57+ }
58+ } )
4659 } )
4760
4861 describe ( 'message ids' , function ( ) {
@@ -83,7 +96,7 @@ describe('MqttClient', function () {
8396 const max = 1000
8497 let count = 0
8598 const duplex = new Duplex ( {
86- read : function ( n ) { } ,
99+ read : function ( n ) { } ,
87100 write : function ( chunk , enc , cb ) {
88101 parser . parse ( chunk )
89102 cb ( ) // nothing to do
@@ -300,7 +313,7 @@ describe('MqttClient', function () {
300313 } )
301314
302315 const server2 = new MqttServer ( function ( serverClient ) {
303- serverClient . on ( 'error' , function ( ) { } )
316+ serverClient . on ( 'error' , function ( ) { } )
304317 debug ( 'setting serverClient connect callback' )
305318 serverClient . on ( 'connect' , function ( packet ) {
306319 if ( packet . clientId === 'invalid' ) {
@@ -397,7 +410,7 @@ describe('MqttClient', function () {
397410
398411 const server2 = net . createServer ( function ( stream ) {
399412 const serverClient = new Connection ( stream )
400- serverClient . on ( 'error' , function ( ) { } )
413+ serverClient . on ( 'error' , function ( ) { } )
401414 serverClient . on ( 'connect' , function ( packet ) {
402415 if ( packet . clientId === 'invalid' ) {
403416 serverClient . connack ( { returnCode : 2 } )
0 commit comments