updated e2e and unit tests
This commit is contained in:
parent
92463b0ccd
commit
d0fc74cefd
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue