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