@@ -7,7 +7,6 @@ import server from '../../app';
77import { PROJECT_STATUS } from '../../constants' ;
88import models from '../../models' ;
99import testUtil from '../../tests/util' ;
10- import RabbitMQService from '../../services/rabbitmq' ;
1110
1211describe ( 'Project upgrade' , ( ) => {
1312 describe ( 'POST /projects/:id/upgrade' , ( ) => {
@@ -132,13 +131,17 @@ describe('Project upgrade', () => {
132131 defaultProductTemplateId : defaultProductTemplate . id ,
133132 } ,
134133 } ;
135- sinon . stub ( RabbitMQService . prototype , 'init' , ( ) => { } ) ;
136- sinon . stub ( RabbitMQService . prototype , 'publish' , ( ) => { } ) ;
134+ // restoring the stubs in beforeEach instead of afterEach because these methods are already stubbed
135+ server . services . pubsub . init . restore ( ) ;
136+ server . services . pubsub . publish . restore ( ) ;
137+ sinon . stub ( server . services . pubsub , 'init' , ( ) => { } ) ;
138+ sinon . stub ( server . services . pubsub , 'publish' , ( ) => { } ) ;
137139 } ) ;
138140
139141 afterEach ( async ( ) => {
140- RabbitMQService . prototype . init . restore ( ) ;
141- RabbitMQService . prototype . publish . restore ( ) ;
142+ // restoring the stubs in beforeEach instead of afterEach because these methods are already stubbed
143+ // server.services.pubsub.init.restore();
144+ // server.services.pubsub.publish.restore();
142145 await testUtil . clearDb ( ) ;
143146 } ) ;
144147
0 commit comments