@@ -40,37 +40,6 @@ setup().then(({client, db}) => {
4040 t . end ( ) ;
4141 } ) ;
4242
43- test ( 'two messages, with first going over 3 tries' , async function ( t ) {
44- const deadQueue = new MongoDBQueue ( db , 'dead-queue-2' ) ;
45- const queue = new MongoDBQueue ( db , 'queue-2' , { visibility : 1 , deadQueue : deadQueue , maxRetries : 3 } ) ;
46- let msg ;
47-
48- const origId = await queue . add ( 'Hello, World!' ) ;
49- t . ok ( origId , 'Received an id for this message' ) ;
50- const origId2 = await queue . add ( 'Part II' ) ;
51- t . ok ( origId2 , 'Received an id for this message' ) ;
52-
53- for ( let i = 1 ; i <= 3 ; i ++ ) {
54- msg = await queue . get ( ) ;
55- t . equal ( msg . id , origId , 'We return the first message on first go' ) ;
56- await new Promise ( ( resolve ) => setTimeout ( function ( ) {
57- t . pass ( `Expiration #${ i } ` ) ;
58- resolve ( ) ;
59- } , 2 * 1000 ) ) ;
60- }
61-
62- msg = await queue . get ( ) ;
63- t . equal ( msg . id , origId2 , 'Got the ID of the 2nd message' ) ;
64- t . equal ( msg . payload , 'Part II' , 'Got the same payload as the 2nd message' ) ;
65-
66- msg = await deadQueue . get ( ) ;
67- t . ok ( msg . id , 'Got a message id from the deadQueue' ) ;
68- t . equal ( msg . payload . id , origId , 'Got the same message id as the original message' ) ;
69- t . equal ( msg . payload . payload , 'Hello, World!' , 'Got the same as the original message' ) ;
70- t . equal ( msg . payload . tries , 4 , 'Got the tries as 4' ) ;
71- t . end ( ) ;
72- } ) ;
73-
7443 test ( 'client.close()' , function ( t ) {
7544 t . pass ( 'client.close()' ) ;
7645 client . close ( ) ;
0 commit comments