From 90268a79b0b267af5e63a593d116f851b377d2d3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 13 Apr 2023 13:41:10 +0200 Subject: [PATCH] refs #5284 test createClaim --- modules/ticket/front/sale/index.spec.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 8585503cc..68973a9e5 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -45,6 +45,7 @@ describe('Ticket', () => { $scope.model = crudModel; $scope.editDiscount = {relocate: () => {}, hide: () => {}}; $scope.editPricePopover = {relocate: () => {}}; + $scope.claimConfirm = {show: () => {}}; $httpBackend = _$httpBackend_; Object.defineProperties($state.params, { id: { @@ -61,6 +62,10 @@ describe('Ticket', () => { controller.card = {reload: () => {}}; controller._ticket = ticket; controller._sales = sales; + controller.ticketConfig = [ + {daysForWarningClaim: 2} + ]; + $httpBackend.expect('GET', 'TicketConfigs').respond(200); })); describe('ticket() setter', () => { @@ -113,7 +118,6 @@ describe('Ticket', () => { it('should make an HTTP GET query and return the worker mana', () => { controller.edit = {}; const expectedAmount = 250; - $httpBackend.expect('GET', 'Tickets/1/getSalesPersonMana').respond(200, expectedAmount); $httpBackend.expect('GET', 'Sales/usesMana').respond(200); $httpBackend.expect('GET', 'WorkerManas/getCurrentWorkerMana').respond(200, expectedAmount); @@ -279,6 +283,17 @@ describe('Ticket', () => { }); describe('createClaim()', () => { + it('should perform a query and call windows open', () => { + jest.spyOn(controller.$.claimConfirm, 'show').mockReturnThis(); + + controller.createClaim(); + $httpBackend.flush(); + + expect(controller.$.claimConfirm); + }); + }); + + describe('onCreateClaimAccepted()', () => { it('should perform a query and call windows open', () => { jest.spyOn(controller, 'resetChanges').mockReturnThis(); jest.spyOn(controller.$state, 'go').mockReturnThis();