@@ -206,6 +206,7 @@ describe('integration tests', () => {
206206
207207 it ( '#fanout: multiple jobs are completed only once' , ( ) => {
208208 const args = [ 'completed' ] ;
209+ const arg1 = 'arg1' ;
209210 const job = sinon . spy ( ( ) => args ) ;
210211 const onComplete = sinon . spy ( ) ;
211212 const unexpectedError = sinon . spy ( ) ;
@@ -218,14 +219,15 @@ describe('integration tests', () => {
218219 const id = String ( idx % 3 ) ;
219220
220221 try {
221- onComplete ( id , await queueManager . dlock . fanout ( id , job ) ) ;
222+ onComplete ( id , await queueManager . dlock . fanout ( id , job , arg1 ) ) ;
222223 } catch ( e ) {
223224 unexpectedError ( e ) ;
224225 }
225226 } )
226227 . delay ( 100 )
227228 . then ( ( ) => {
228229 assert . equal ( job . callCount , 3 ) ;
230+ assert . equal ( job . withArgs ( arg1 ) . callCount , 3 ) ;
229231 assert . equal ( onComplete . withArgs ( '0' , args ) . callCount , 4 ) ;
230232 assert . equal ( onComplete . withArgs ( '1' , args ) . callCount , 3 ) ;
231233 assert . equal ( onComplete . withArgs ( '2' , args ) . callCount , 3 ) ;
@@ -238,6 +240,7 @@ describe('integration tests', () => {
238240 const job = sinon . spy ( async ( ) => {
239241 await Promise . delay ( 3000 ) ;
240242 } ) ;
243+ const arg1 = 'arg1' ;
241244 const onComplete = sinon . spy ( ) ;
242245 const timeoutError = sinon . spy ( ) ;
243246 const unexpectedError = sinon . spy ( ) ;
@@ -246,7 +249,7 @@ describe('integration tests', () => {
246249 const id = String ( idx % 3 ) ;
247250
248251 try {
249- const result = await queueManager . dlock . fanout ( id , 1500 , job ) ;
252+ const result = await queueManager . dlock . fanout ( id , 1500 , job , arg1 ) ;
250253 onComplete ( result ) ;
251254 } catch ( e ) {
252255 if ( e . message === 'queue-no-response' ) {
@@ -258,6 +261,7 @@ describe('integration tests', () => {
258261 } ) ;
259262
260263 assert . equal ( job . callCount , 3 ) ;
264+ assert . equal ( job . withArgs ( arg1 ) . callCount , 3 ) ;
261265 assert . equal ( onComplete . callCount , 0 ) ;
262266 assert . equal ( timeoutError . callCount , 10 ) ;
263267 assert . equal ( timeoutError . withArgs ( sinon . match ( { message : 'queue-no-response' } ) ) . callCount , 10 ) ;
0 commit comments