@@ -96,6 +96,30 @@ describe("The node_redis client", function () {
96
96
done ( ) ;
97
97
} ) ;
98
98
} ) ;
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
+ } ) ;
99
123
} ) ;
100
124
101
125
describe ( "send_command" , function ( ) {
@@ -135,7 +159,7 @@ describe("The node_redis client", function () {
135
159
136
160
describe ( ".end" , function ( ) {
137
161
138
- it ( 'used without flush' , function ( done ) {
162
+ it ( 'used without flush / flush set to false ' , function ( done ) {
139
163
var finished = false ;
140
164
var end = helper . callFuncAfter ( function ( ) {
141
165
if ( ! finished ) {
@@ -513,7 +537,7 @@ describe("The node_redis client", function () {
513
537
client . retry_backoff = 1 ;
514
538
client . stream . end ( ) ;
515
539
} else {
516
- client . end ( ) ;
540
+ client . end ( true ) ;
517
541
var lasted = new Date ( ) . getTime ( ) - time ;
518
542
assert . ok ( lasted < 100 ) ;
519
543
return done ( ) ;
0 commit comments