@@ -162,7 +162,8 @@ describe("Auto pipeline", () => {
162
162
] ) ;
163
163
expect ( result ) . toBeTruthy ( ) ;
164
164
expect ( result . length ) . toBe ( 134 ) ; // returns
165
- // @ts -expect-error pipelineCounter is not in type but accessible120 results
165
+
166
+ // @ts -expect-error pipelineCounter is not in type but accessible results
166
167
expect ( redis . pipelineCounter ) . toBe ( 1 ) ;
167
168
} ) ;
168
169
@@ -376,4 +377,33 @@ describe("Auto pipeline", () => {
376
377
const result = await redis . get ( "foobar" ) ;
377
378
expect ( result ) . toBe ( "foobar" ) ;
378
379
} ) ;
380
+
381
+ describe ( "excluded commands" , ( ) => {
382
+ test ( "should not exclude set" , async ( ) => {
383
+ const redis = Redis . fromEnv ( ) ;
384
+ // @ts -expect-error pipelineCounter is not in type but accessible
385
+ expect ( redis . pipelineCounter ) . toBe ( 0 ) ;
386
+
387
+ await redis . set ( "foo" , "bar" ) ;
388
+
389
+ // @ts -expect-error pipelineCounter is not in type but accessible
390
+ expect ( redis . pipelineCounter ) . toBe ( 1 ) ;
391
+ } ) ;
392
+
393
+ test ( "should exclude some commands" , async ( ) => {
394
+ const redis = Redis . fromEnv ( { } ) ;
395
+
396
+ // @ts -expect-error pipelineCounter is not in type but accessible
397
+ expect ( redis . pipelineCounter ) . toBe ( 0 ) ;
398
+
399
+ await redis . scan ( 0 , { count : 1 } ) ;
400
+ await redis . keys ( "some-random-pattern" ) ;
401
+ await redis . flushdb ( ) ;
402
+ await redis . flushall ( ) ;
403
+ await redis . dbsize ( ) ;
404
+
405
+ // @ts -expect-error pipelineCounter is not in type but accessible
406
+ expect ( redis . pipelineCounter ) . toBe ( 0 ) ;
407
+ } ) ;
408
+ } ) ;
379
409
} ) ;
0 commit comments