@@ -17,12 +17,12 @@ class PipelineStub {
1717 this . ops = [ ] ;
1818 }
1919
20- updateCounter ( key , ts , value ) {
21- this . ops . push ( [ key , ts , value ] ) ;
20+ updateCounter ( key , cost ) {
21+ this . ops . push ( [ key , cost ] ) ;
2222 }
2323
2424 exec ( cb ) {
25- cb ( null , this . ops . map ( v => [ 1 , v [ 2 ] ] ) ) ;
25+ cb ( null , this . ops . map ( v => [ 1 , v [ 1 ] ] ) ) ;
2626 }
2727}
2828
@@ -38,19 +38,18 @@ describe('test RateLimitClient', () => {
3838 } ) ;
3939
4040 it ( 'should update a batch of counters' , done => {
41- const ts = Date . now ( ) ;
4241 const batch = [
43- { key : 'foo' , ts , counter : ts + 100 } ,
44- { key : 'bar' , ts , counter : ts + 200 } ,
45- { key : 'qux' , ts , counter : ts + 300 } ,
42+ { key : 'foo' , cost : 100 } ,
43+ { key : 'bar' , cost : 200 } ,
44+ { key : 'qux' , cost : 300 } ,
4645 ]
4746
4847 client . updateLocalCounters ( batch , ( err , results ) => {
4948 assert . ifError ( err ) ;
5049 assert . deepStrictEqual ( results , [
51- [ 'foo' , ts + 100 ] ,
52- [ 'bar' , ts + 200 ] ,
53- [ 'qux' , ts + 300 ] ,
50+ { key : 'foo' , value : 100 } ,
51+ { key : 'bar' , value : 200 } ,
52+ { key : 'qux' , value : 300 } ,
5453 ] ) ;
5554 done ( ) ;
5655 } ) ;
0 commit comments