diff --git a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js index e6c5bb221..1f768c272 100644 --- a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js +++ b/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js @@ -92,13 +92,4 @@ describe('Ticket List sale path', () => { expect(sales).toEqual(1); }); - - it('should navigate to the catalog by pressing the new item button', async() => { - const url = await nightmare - .waitToClick(selectors.ticketSales.newItemFromCatalogButton) - .waitForURL('/catalog') - .parsedUrl(); - - expect(url.hash).toContain('/catalog'); - }); }); diff --git a/modules/ticket/front/sale/specs/index.spec.js b/modules/ticket/front/sale/specs/index.spec.js index 29b5c0de5..13a789937 100644 --- a/modules/ticket/front/sale/specs/index.spec.js +++ b/modules/ticket/front/sale/specs/index.spec.js @@ -1,7 +1,7 @@ import '../index.js'; import watcher from 'core/mocks/watcher'; -describe('Ticket', () => { +fdescribe('Ticket', () => { describe('Component vnTicketSale', () => { let controller; let $scope; @@ -317,5 +317,26 @@ describe('Ticket', () => { expect(lastActiveTickets[0].id).toEqual(4); }); }); + + describe('newOrderFromTicket()', () => { + it('should make an HTTP post query and then open the new order on a new tab', () => { + const params = {ticketFk: 1}; + const expectedResponse = {id: 123}; + + window.open = jasmine.createSpy('open'); + controller.$state.href = jasmine.createSpy('href') + .and.returnValue('/somePath'); + + $httpBackend.when('POST', `/api/Orders/newFromTicket`, params).respond(expectedResponse); + $httpBackend.expect('POST', `/api/Orders/newFromTicket`, params).respond(expectedResponse); + $httpBackend.whenGET(`/api/Tickets/1/subtotal`).respond(200, 227.5); + $httpBackend.whenGET(`/api/Tickets/1/getVAT`).respond(200, 10.5); + $httpBackend.whenGET(`/api/Tickets/1/isEditable`).respond(); + controller.newOrderFromTicket(); + $httpBackend.flush(); + + expect(window.open).toHaveBeenCalledWith('/somePath', '_blank'); + }); + }); }); });