@@ -193,20 +193,23 @@ describe('services/abstract-microservice', () => {
193193
194194 ms . addEndpoint ( endpoint , handler , handlerOptions ) ;
195195
196- expect ( ms )
197- . to . have . property ( 'endpoints' )
196+ const endpoints = ms . getEndpoints ( ) ;
197+
198+ expect ( endpoints )
198199 . to . have . property ( endpoint )
199200 . to . have . property ( 'options' )
200201 . to . include ( handlerOptions ) ;
201202 } ) ;
202203
203- it ( 'should correct remove endpoint handler' , ( ) => {
204+ it ( 'should correctly remove endpoint handler' , ( ) => {
204205 ms . removeEndpoint ( testEndpoint ) ;
205206
206- expect ( ms ) . to . have . property ( 'endpoints' ) . to . not . have . property ( testEndpoint ) ;
207+ const endpoints = ms . getEndpoints ( ) ;
208+
209+ expect ( endpoints ) . to . not . have . property ( testEndpoint ) ;
207210 } ) ;
208211
209- it ( 'should correct start worker & return error unknown method & return base microservice exception' , async ( ) => {
212+ it ( 'should correctly start worker & return error unknown method & return base microservice exception' , async ( ) => {
210213 const req = new MicroserviceRequest ( { id : 1 , method : 'sample' } ) ;
211214
212215 const stubbed = await createAxiosMock ( req . toJSON ( ) ) ;
@@ -220,7 +223,7 @@ describe('services/abstract-microservice', () => {
220223 expect ( secondCall . data . toString ( ) . includes ( 'Unknown method' ) ) . to . ok ;
221224 } ) ;
222225
223- it ( 'should correct start worker & return error unknown method - internal request (private route)' , async ( ) => {
226+ it ( 'should correctly start worker & return error unknown method - internal request (private route)' , async ( ) => {
224227 const endpoint = 'sample-private' ;
225228 const req = new MicroserviceRequest ( { id : 1 , method : endpoint } ) ;
226229
@@ -233,7 +236,7 @@ describe('services/abstract-microservice', () => {
233236 expect ( secondCall . data . toString ( ) . includes ( 'Unknown method' ) ) . to . ok ;
234237 } ) ;
235238
236- it ( 'should correct start worker & return success response' , async ( ) => {
239+ it ( 'should correctly start worker & return success response' , async ( ) => {
237240 const endpoint = 'get-string' ;
238241 const result = { good : 'job' } ;
239242 const req = new MicroserviceRequest ( { id : 2 , method : endpoint , params : { hello : 1 } } ) ;
@@ -246,7 +249,7 @@ describe('services/abstract-microservice', () => {
246249 expect ( secondCall . data . getResult ( ) ) . to . deep . equal ( result ) ;
247250 } ) ;
248251
249- it ( 'should correct start worker & return success response handled by middlewares' , async ( ) => {
252+ it ( 'should correctly start worker & return success response handled by middlewares' , async ( ) => {
250253 const result = { success : true } ;
251254 const req = new MicroserviceRequest ( {
252255 id : 2 ,
@@ -264,7 +267,7 @@ describe('services/abstract-microservice', () => {
264267 expect ( handler . firstCall . firstArg ) . to . deep . equal ( { ...req . getParams ( ) , middleware : 'before' } ) ;
265268 } ) ;
266269
267- it ( 'should correct start worker & return endpoint exception' , async ( ) => {
270+ it ( 'should correctly start worker & return endpoint exception' , async ( ) => {
268271 const method = 'need-exception' ;
269272 const req = new MicroserviceRequest ( { id : 2 , method } ) ;
270273 const customErrorParams = { code : 1 , payload : { hello : 'error' } } ;
@@ -295,7 +298,7 @@ describe('services/abstract-microservice', () => {
295298 expect ( customError ) . to . have . property ( 'payload' ) . to . deep . equal ( customErrorParams . payload ) ;
296299 } ) ;
297300
298- it ( 'should correct start worker & return ijson exception & return success response' , async ( ) => {
301+ it ( 'should correctly start worker & return ijson exception & return success response' , async ( ) => {
299302 const req = new MicroserviceRequest ( { id : 2 , method : 'test' } ) ;
300303
301304 const stubbed = sinon
@@ -316,7 +319,7 @@ describe('services/abstract-microservice', () => {
316319 expect ( secondCall . getError ( ) ) . to . instanceof ( BaseException ) ;
317320 } ) ;
318321
319- it ( 'should correct send request to another microservice' , async ( ) => {
322+ it ( 'should correctly send request to another microservice' , async ( ) => {
320323 const microservice = 'demo' ;
321324 const method = 'example' ;
322325 const response = { success : true } ;
@@ -330,11 +333,11 @@ describe('services/abstract-microservice', () => {
330333
331334 expect ( result ) . to . instanceof ( MicroserviceResponse ) ;
332335 expect ( result . getResult ( ) ) . to . deep . equal ( response ) ;
333- // Set correct microservice url
336+ // Set correctly microservice url
334337 expect ( url ) . to . equal ( `${ options . connection } /${ ms . getChannelPrefix ( ) } /${ microservice } ` ) ;
335- // Correct pass params to request
338+ // correctly pass params to request
336339 expect ( data . params ) . to . deep . equal ( params ) ;
337- // Correct generate request id
340+ // correctly generate request id
338341 expect ( data . id ) . to . not . empty ;
339342 } ) ;
340343
@@ -351,7 +354,7 @@ describe('services/abstract-microservice', () => {
351354
352355 expect ( e ) . to . instanceof ( BaseException ) ;
353356 expect ( e . message ) . to . equal ( message ) ;
354- // Correct disable autogenerate id
357+ // correctly disable autogenerate id
355358 expect ( data . id ) . to . undefined ;
356359 }
357360
@@ -389,7 +392,7 @@ describe('services/abstract-microservice', () => {
389392 stubbed . restore ( ) ;
390393 } ) ;
391394
392- it ( 'should correct remove middleware handler' , ( ) => {
395+ it ( 'should correctly remove middleware handler' , ( ) => {
393396 ms . removeMiddleware ( middlewareHandlerBefore ) ;
394397 ms . removeMiddleware ( ( ) => undefined ) ;
395398
@@ -400,7 +403,7 @@ describe('services/abstract-microservice', () => {
400403 . lengthOf ( 1 ) ;
401404 } ) ;
402405
403- it ( 'should correct return channel prefix' , ( ) => {
406+ it ( 'should correctly return channel prefix' , ( ) => {
404407 expect ( ms ) . to . have . property ( 'channelPrefix' ) . to . equal ( ms . getChannelPrefix ( ) ) ;
405408 } ) ;
406409} ) ;
0 commit comments