@@ -47,7 +47,7 @@ describe("autoPipelining for single node", () => {
47
47
it ( "should support buffer commands" , async ( ) => {
48
48
const redis = new Redis ( { enableAutoPipelining : true } ) ;
49
49
const buffer = Buffer . from ( "bar" ) ;
50
- await redis . setBuffer ( "foo" , buffer ) ;
50
+ await redis . set ( "foo" , buffer ) ;
51
51
const promise = redis . getBuffer ( "foo" ) ;
52
52
expect ( redis . autoPipelineQueueSize ) . to . eql ( 1 ) ;
53
53
expect ( await promise ) . to . eql ( buffer ) ;
@@ -56,16 +56,33 @@ describe("autoPipelining for single node", () => {
56
56
it ( "should support custom commands" , async ( ) => {
57
57
const redis = new Redis ( { enableAutoPipelining : true } ) ;
58
58
59
- redis . defineCommand ( "echo " , {
59
+ redis . defineCommand ( "myecho " , {
60
60
numberOfKeys : 2 ,
61
61
lua : "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" ,
62
62
} ) ;
63
63
64
- const promise = redis . echo ( "foo1" , "foo2" , "bar1" , "bar2" ) ;
64
+ // @ts -expect-error
65
+ const promise = redis . myecho ( "foo1" , "foo2" , "bar1" , "bar2" ) ;
65
66
expect ( redis . autoPipelineQueueSize ) . to . eql ( 1 ) ;
66
67
expect ( await promise ) . to . eql ( [ "foo1" , "foo2" , "bar1" , "bar2" ] ) ;
67
68
68
- await redis . echo ( "foo1" , "foo2" , "bar1" , "bar2" ) ;
69
+ // @ts -expect-error
70
+ await redis . myecho ( "foo1" , "foo2" , "bar1" , "bar2" ) ;
71
+ } ) ;
72
+
73
+ it ( "should support call()" , async ( ) => {
74
+ const redis = new Redis ( { enableAutoPipelining : true } ) ;
75
+ await redis . call ( "set" , "foo" , "call()" ) ;
76
+
77
+ expect (
78
+ await Promise . all ( [
79
+ redis . get ( "foo" ) ,
80
+ redis . get ( "foo" ) ,
81
+ redis . get ( "foo" ) ,
82
+ redis . get ( "foo" ) ,
83
+ redis . get ( "foo" ) ,
84
+ ] )
85
+ ) . to . eql ( [ "call()" , "call()" , "call()" , "call()" , "call()" ] ) ;
69
86
} ) ;
70
87
71
88
it ( "should support multiple commands" , async ( ) => {
@@ -133,6 +150,7 @@ describe("autoPipelining for single node", () => {
133
150
it ( "should handle rejections" , async ( ) => {
134
151
const redis = new Redis ( { enableAutoPipelining : true } ) ;
135
152
await redis . set ( "foo" , "bar" ) ;
153
+ // @ts -expect-error
136
154
await expect ( redis . set ( "foo" ) ) . to . eventually . be . rejectedWith (
137
155
"ERR wrong number of arguments for 'set' command"
138
156
) ;
@@ -180,6 +198,7 @@ describe("autoPipelining for single node", () => {
180
198
181
199
expect ( redis . autoPipelineQueueSize ) . to . eql ( 1 ) ;
182
200
201
+ // @ts -expect-error
183
202
redis . set ( "foo2" , ( err ) => {
184
203
expect ( err . message ) . to . include (
185
204
"ERR wrong number of arguments for 'set' command"
0 commit comments