@@ -24,71 +24,75 @@ describe('XAUTOCLAIM', () => {
24
24
} ) ;
25
25
26
26
testUtils . testWithClient ( 'client.xAutoClaim without messages' , async client => {
27
- await Promise . all ( [
27
+ const [ , , reply ] = await Promise . all ( [
28
28
client . xGroupCreate ( 'key' , 'group' , '$' , { MKSTREAM : true } ) ,
29
29
client . xGroupCreateConsumer ( 'key' , 'group' , 'consumer' ) ,
30
+ client . xAutoClaim ( 'key' , 'group' , 'consumer' , 1 , '0-0' )
30
31
] ) ;
31
32
32
- assert . deepEqual (
33
- await client . xAutoClaim ( 'key' , 'group' , 'consumer' , 1 , '0-0' ) ,
34
- {
35
- nextId : '0-0' ,
36
- messages : [ ]
37
- }
38
- ) ;
33
+ assert . deepEqual ( reply , {
34
+ nextId : '0-0' ,
35
+ messages : [ ]
36
+ } ) ;
39
37
} , GLOBAL . SERVERS . OPEN ) ;
40
38
41
39
testUtils . testWithClient ( 'client.xAutoClaim with messages' , async client => {
42
- await client . xGroupCreate ( 'key' , 'group' , '$' , { MKSTREAM : true } ) ;
43
- await client . xGroupCreateConsumer ( 'key' , 'group' , 'consumer' ) ;
44
- const id = await client . xAdd ( 'key' , '*' , { foo : 'bar' } ) ;
45
- await client . xReadGroup ( 'group' , 'consumer' , { key : 'key' , id : '>' } ) ;
40
+ const [ , , id , , reply ] = await Promise . all ( [
41
+ client . xGroupCreate ( 'key' , 'group' , '$' , { MKSTREAM : true } ) ,
42
+ client . xGroupCreateConsumer ( 'key' , 'group' , 'consumer' ) ,
43
+ client . xAdd ( 'key' , '*' , { foo : 'bar' } ) ,
44
+ client . xReadGroup ( 'group' , 'consumer' , { key : 'key' , id : '>' } ) ,
45
+ client . xAutoClaim ( 'key' , 'group' , 'consumer' , 0 , '0-0' )
46
+ ] ) ;
46
47
47
- assert . deepEqual (
48
- await client . xAutoClaim ( 'key' , 'group' , 'consumer' , 0 , '0-0' ) ,
49
- {
50
- nextId : '0-0' ,
51
- messages : [ {
52
- id,
53
- message : Object . create ( null , { 'foo' : {
48
+ assert . deepEqual ( reply , {
49
+ nextId : '0-0' ,
50
+ messages : [ {
51
+ id,
52
+ message : Object . create ( null , {
53
+ foo : {
54
54
value : 'bar' ,
55
55
configurable : true ,
56
56
enumerable : true
57
- } } )
58
- } ]
59
- }
60
- ) ;
57
+ }
58
+ } )
59
+ } ]
60
+ } ) ;
61
61
} , GLOBAL . SERVERS . OPEN ) ;
62
62
63
63
testUtils . testWithClient ( 'client.xAutoClaim with trimmed messages' , async client => {
64
- await client . xGroupCreate ( 'key' , 'group' , '$' , { MKSTREAM : true } ) ;
65
- await client . xGroupCreateConsumer ( 'key' , 'group' , 'consumer' ) ;
66
- await client . xAdd ( 'key' , '*' , { foo : 'bar' } ) ;
67
- await client . xReadGroup ( 'group' , 'consumer' , { key : 'key' , id : '>' } ) ;
68
- await client . xTrim ( 'key' , 'MAXLEN' , 0 ) ;
69
- const id = await client . xAdd ( 'key' , '*' , { bar : 'baz' } ) ;
70
- await client . xReadGroup ( 'group' , 'consumer' , { key : 'key' , id : '>' } ) ;
64
+ const [ , , , , , id , , reply ] = await Promise . all ( [
65
+ client . xGroupCreate ( 'key' , 'group' , '$' , { MKSTREAM : true } ) ,
66
+ client . xGroupCreateConsumer ( 'key' , 'group' , 'consumer' ) ,
67
+ client . xAdd ( 'key' , '*' , { foo : 'bar' } ) ,
68
+ client . xReadGroup ( 'group' , 'consumer' , { key : 'key' , id : '>' } ) ,
69
+ client . xTrim ( 'key' , 'MAXLEN' , 0 ) ,
70
+ client . xAdd ( 'key' , '*' , { bar : 'baz' } ) ,
71
+ client . xReadGroup ( 'group' , 'consumer' , { key : 'key' , id : '>' } ) ,
72
+ client . xAutoClaim ( 'key' , 'group' , 'consumer' , 0 , '0-0' )
73
+ ] ) ;
71
74
72
- assert . deepEqual (
73
- await client . xAutoClaim ( 'key' , 'group' , 'consumer' , 0 , '0-0' ) ,
74
- {
75
- nextId : '0-0' ,
76
- messages : testUtils . isVersionGreaterThan ( [ 7 , 0 ] ) ? [ {
77
- id,
78
- message : Object . create ( null , { 'bar' : {
75
+ assert . deepEqual ( reply , {
76
+ nextId : '0-0' ,
77
+ messages : testUtils . isVersionGreaterThan ( [ 7 , 0 ] ) ? [ {
78
+ id,
79
+ message : Object . create ( null , {
80
+ bar : {
79
81
value : 'baz' ,
80
82
configurable : true ,
81
83
enumerable : true
82
- } } )
83
- } ] : [ null , {
84
- id,
85
- message : Object . create ( null , { 'bar' : {
84
+ }
85
+ } )
86
+ } ] : [ null , {
87
+ id,
88
+ message : Object . create ( null , {
89
+ bar : {
86
90
value : 'baz' ,
87
91
configurable : true ,
88
92
enumerable : true
89
- } } )
90
- } ]
91
- }
92
- ) ;
93
+ }
94
+ } )
95
+ } ]
96
+ } ) ;
93
97
} , GLOBAL . SERVERS . OPEN ) ;
94
98
} ) ;
0 commit comments