@@ -215,7 +215,7 @@ describe('Client', () => {
215
215
216
216
testUtils . testWithClient ( 'client.hGetAll should return object' , async client => {
217
217
await client . v4 . hSet ( 'key' , 'field' , 'value' ) ;
218
-
218
+
219
219
assert . deepEqual (
220
220
await promisify ( client . hGetAll ) . call ( client , 'key' ) ,
221
221
Object . create ( null , {
@@ -317,7 +317,7 @@ describe('Client', () => {
317
317
}
318
318
} ) ;
319
319
320
- testUtils . testWithClient ( 'client.multi.hGetAll should return object' , async client => {
320
+ testUtils . testWithClient ( 'client.multi.hGetAll should return object' , async client => {
321
321
assert . deepEqual (
322
322
await multiExecAsync (
323
323
client . multi ( )
@@ -607,24 +607,48 @@ describe('Client', () => {
607
607
return client . executeIsolated ( isolated => killClient ( isolated , client ) ) ;
608
608
} , GLOBAL . SERVERS . OPEN ) ;
609
609
610
- testUtils . testWithClient ( 'scanIterator' , async client => {
611
- const promises = [ ] ,
612
- keys = new Set ( ) ;
613
- for ( let i = 0 ; i < 100 ; i ++ ) {
614
- const key = i . toString ( ) ;
615
- keys . add ( key ) ;
616
- promises . push ( client . set ( key , '' ) ) ;
617
- }
610
+ describe ( 'scanIterator' , ( ) => {
611
+ testUtils . testWithClient ( 'strings' , async client => {
612
+ const args : Array < string > = [ ] ,
613
+ keys = new Set < string > ( ) ;
614
+ for ( let i = 0 ; i < 100 ; i ++ ) {
615
+ const key = i . toString ( ) ;
616
+ args . push ( key , '' ) ;
617
+ keys . add ( key ) ;
618
+ }
618
619
619
- await Promise . all ( promises ) ;
620
+ await client . mSet ( args ) ;
620
621
621
- const results = new Set ( ) ;
622
- for await ( const key of client . scanIterator ( ) ) {
623
- results . add ( key ) ;
624
- }
622
+ const results = new Set < string > ( ) ;
623
+ for await ( const key of client . scanIterator ( ) ) {
624
+ results . add ( key ) ;
625
+ }
625
626
626
- assert . deepEqual ( keys , results ) ;
627
- } , GLOBAL . SERVERS . OPEN ) ;
627
+ assert . deepEqual ( keys , results ) ;
628
+ } , GLOBAL . SERVERS . OPEN ) ;
629
+
630
+ testUtils . testWithClient ( 'buffers' , async client => {
631
+ const args : Array < string | Buffer > = [ ] ,
632
+ keys = new Set < Buffer > ( ) ;
633
+ for ( let i = 0 ; i < 100 ; i ++ ) {
634
+ const key = Buffer . from ( [ i ] ) ;
635
+ args . push ( key , '' ) ;
636
+ keys . add ( key ) ;
637
+ }
638
+
639
+ await client . mSet ( args ) ;
640
+
641
+ const results = new Set < Buffer > ( ) ,
642
+ iteartor = client . scanIterator (
643
+ client . commandOptions ( { returnBuffers : true } )
644
+ ) ;
645
+ for await ( const key of iteartor ) {
646
+ results . add ( key ) ;
647
+ }
648
+
649
+ assert . deepEqual ( keys , results ) ;
650
+ } , GLOBAL . SERVERS . OPEN ) ;
651
+ } ) ;
628
652
629
653
testUtils . testWithClient ( 'hScanIterator' , async client => {
630
654
const hash : Record < string , string > = { } ;
0 commit comments