diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 96f2c8172..c2be4379d 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -5,6 +5,7 @@ fdescribe('regularizeClaim()', () => { const pendentState = 1; const resolvedState = 3; const trashDestination = 2; + const okDestination = 1; const trashAddress = 12; let claimEnds = []; let trashTicket; @@ -55,6 +56,7 @@ fdescribe('regularizeClaim()', () => { expect(claimBefore.claimStateFk).toEqual(pendentState); expect(claimAfter.claimStateFk).toEqual(resolvedState); expect(chatModel.sendCheckingPresence).toHaveBeenCalledWith(ctx, 18, 'Trash'); + expect(chatModel.sendCheckingPresence).toHaveBeenCalledTimes(4); }); it('should send a chat message with value "Bueno" and then change claim state to resolved', async() => { @@ -73,11 +75,12 @@ fdescribe('regularizeClaim()', () => { spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); claimEnds.forEach(async claimEnd => { - claimEnd.updateAttributes({claimDestinationFk: 1}); + claimEnd.updateAttributes({claimDestinationFk: okDestination}); }); await app.models.Claim.regularizeClaim(ctx, params); expect(chatModel.sendCheckingPresence).toHaveBeenCalledWith(ctx, 18, 'Bueno'); + expect(chatModel.sendCheckingPresence).toHaveBeenCalledTimes(4); }); });