@@ -21,6 +21,56 @@ runTwinSuite('lpop', (command, equals) => {
21
21
}
22
22
)
23
23
24
+ // @TODO Rewrite test so it runs on a real Redis instance
25
+ ; ( process . env . IS_E2E ? it . skip : it ) (
26
+ 'should remove key and return first elements when it was last on the list' ,
27
+ ( ) => {
28
+ const redis = new Redis ( {
29
+ data : {
30
+ foo : [ '1' ] ,
31
+ } ,
32
+ } )
33
+
34
+ return redis [ command ] ( 'foo' )
35
+ . then ( result => expect ( equals ( result , '1' ) ) . toBe ( true ) )
36
+ . then ( ( ) => redis . exists ( 'foo' ) )
37
+ . then ( status => expect ( status ) . toBe ( 0 ) )
38
+ }
39
+ )
40
+
41
+ // @TODO Rewrite test so it runs on a real Redis instance
42
+ ; ( process . env . IS_E2E ? it . skip : it ) (
43
+ 'should remove and return "count" elements if second argument is provided' ,
44
+ ( ) => {
45
+ const redis = new Redis ( {
46
+ data : {
47
+ foo : [ '5' , '4' , '3' , '2' , '1' ] ,
48
+ } ,
49
+ } )
50
+
51
+ return redis [ command ] ( 'foo' , 2 )
52
+ . then ( result => expect ( result . map ( v => Buffer . isBuffer ( v ) ? v . toString ( ) : v ) ) . toEqual ( [ '5' , '4' ] ) )
53
+ . then ( ( ) => expect ( redis . data . get ( 'foo' ) ) . toEqual ( [ '3' , '2' , '1' ] ) )
54
+ }
55
+ )
56
+
57
+ // @TODO Rewrite test so it runs on a real Redis instance
58
+ ; ( process . env . IS_E2E ? it . skip : it ) (
59
+ 'should remove key and return all elements on larger number if second argument is provided' ,
60
+ ( ) => {
61
+ const redis = new Redis ( {
62
+ data : {
63
+ foo : [ '5' , '4' , '3' , '2' , '1' ] ,
64
+ } ,
65
+ } )
66
+
67
+ return redis [ command ] ( 'foo' , 7 )
68
+ . then ( result => expect ( result . map ( v => Buffer . isBuffer ( v ) ? v . toString ( ) : v ) ) . toEqual ( [ '5' , '4' , '3' , '2' , '1' ] ) )
69
+ . then ( ( ) => redis . exists ( 'foo' ) )
70
+ . then ( status => expect ( status ) . toBe ( 0 ) )
71
+ }
72
+ )
73
+
24
74
// @TODO Rewrite test so it runs on a real Redis instance
25
75
; ( process . env . IS_E2E ? it . skip : it ) (
26
76
'should return buffer values correctly as buffer' ,
0 commit comments