@@ -194,6 +194,51 @@ describe('Test rabbit class', function() {
194194 options ! . arguments . should . not . have . property ( 'x-max-priority' ) ;
195195 } ) ;
196196
197+ it ( 'should set queue type to classic when creating a non durable queue' , async function ( ) {
198+ const subscription = sandbox . stub ( Queue . prototype , 'subscribe' ) ;
199+ rabbit = new Rabbit ( this . url , { defaultQueueType : 'quorum' } ) ;
200+ await rabbit . connected ;
201+ const stub = sandbox . stub ( rabbit . consumeChannel , 'assertQueue' )
202+ . resolves ( { queue : this . name , messageCount : 0 , consumerCount : 0 } ) ;
203+ const handler = ( ) => { } ;
204+ await rabbit . createQueue ( this . name , { durable : false } , handler ) ;
205+ subscription . calledWith ( handler ) . should . be . true ( ) ;
206+ stub . calledOnce . should . be . true ( ) ;
207+ const [ name , options ] = stub . firstCall . args ;
208+ name . should . equal ( this . name ) ;
209+ options ! . arguments [ 'x-queue-type' ] . should . equals ( 'classic' ) ;
210+ } ) ;
211+
212+ it ( 'should set queue type to classic when creating an exclusive queue' , async function ( ) {
213+ const subscription = sandbox . stub ( Queue . prototype , 'subscribe' ) ;
214+ rabbit = new Rabbit ( this . url , { defaultQueueType : 'quorum' } ) ;
215+ await rabbit . connected ;
216+ const stub = sandbox . stub ( rabbit . consumeChannel , 'assertQueue' )
217+ . resolves ( { queue : this . name , messageCount : 0 , consumerCount : 0 } ) ;
218+ const handler = ( ) => { } ;
219+ await rabbit . createQueue ( this . name , { exclusive : true } , handler ) ;
220+ subscription . calledWith ( handler ) . should . be . true ( ) ;
221+ stub . calledOnce . should . be . true ( ) ;
222+ const [ name , options ] = stub . firstCall . args ;
223+ name . should . equal ( this . name ) ;
224+ options ! . arguments [ 'x-queue-type' ] . should . equals ( 'classic' ) ;
225+ } ) ;
226+
227+ it ( 'should set queue type to classic when creating an auto delete queue' , async function ( ) {
228+ const subscription = sandbox . stub ( Queue . prototype , 'subscribe' ) ;
229+ rabbit = new Rabbit ( this . url , { defaultQueueType : 'quorum' } ) ;
230+ await rabbit . connected ;
231+ const stub = sandbox . stub ( rabbit . consumeChannel , 'assertQueue' )
232+ . resolves ( { queue : this . name , messageCount : 0 , consumerCount : 0 } ) ;
233+ const handler = ( ) => { } ;
234+ await rabbit . createQueue ( this . name , { autoDelete : true } , handler ) ;
235+ subscription . calledWith ( handler ) . should . be . true ( ) ;
236+ stub . calledOnce . should . be . true ( ) ;
237+ const [ name , options ] = stub . firstCall . args ;
238+ name . should . equal ( this . name ) ;
239+ options ! . arguments [ 'x-queue-type' ] . should . equals ( 'classic' ) ;
240+ } ) ;
241+
197242 it ( 'should unsubscribe' , async function ( ) {
198243 const stub = sandbox . stub ( Queue . prototype , 'unsubscribe' ) ;
199244 rabbit = new Rabbit ( this . url ) ;
0 commit comments