@@ -96,6 +96,30 @@ describe("The node_redis client", function () {
9696 done ( ) ;
9797 } ) ;
9898 } ) ;
99+
100+ it ( 'safe strings that are bigger than 30000 characters with multi' , function ( done ) {
101+ var str = 'foo ಠ_ಠ bar ' ;
102+ while ( str . length < 111111 ) {
103+ str += str ;
104+ }
105+ var called = false ;
106+ var temp = client . writeBuffers . bind ( client ) ;
107+ assert ( String ( client . writeBuffers ) !== String ( client . writeDefault ) ) ;
108+ client . writeBuffers = function ( data ) {
109+ called = true ;
110+ // To increase write performance for strings the value is converted to a buffer
111+ assert ( String ( client . writeBuffers ) === String ( client . writeDefault ) ) ;
112+ temp ( data ) ;
113+ } ;
114+ client . multi ( ) . set ( 'foo' , str ) . get ( 'foo' , function ( err , res ) {
115+ assert . strictEqual ( res , str ) ;
116+ } ) . exec ( function ( err , res ) {
117+ assert ( called ) ;
118+ assert . strictEqual ( res [ 1 ] , str ) ;
119+ done ( ) ;
120+ } ) ;
121+ assert ( String ( client . writeBuffers ) !== String ( client . writeDefault ) ) ;
122+ } ) ;
99123 } ) ;
100124
101125 describe ( "send_command" , function ( ) {
@@ -135,7 +159,7 @@ describe("The node_redis client", function () {
135159
136160 describe ( ".end" , function ( ) {
137161
138- it ( 'used without flush' , function ( done ) {
162+ it ( 'used without flush / flush set to false ' , function ( done ) {
139163 var finished = false ;
140164 var end = helper . callFuncAfter ( function ( ) {
141165 if ( ! finished ) {
@@ -513,7 +537,7 @@ describe("The node_redis client", function () {
513537 client . retry_backoff = 1 ;
514538 client . stream . end ( ) ;
515539 } else {
516- client . end ( ) ;
540+ client . end ( true ) ;
517541 var lasted = new Date ( ) . getTime ( ) - time ;
518542 assert . ok ( lasted < 100 ) ;
519543 return done ( ) ;
0 commit comments