BREACKING CHANGE: claim redirect to lilium #2843
|
@ -295,20 +295,26 @@ describe('Ticket', () => {
|
||||||
describe('onCreateClaimAccepted()', () => {
|
describe('onCreateClaimAccepted()', () => {
|
||||||
it('should perform a query and call window open', () => {
|
it('should perform a query and call window open', () => {
|
||||||
jest.spyOn(controller, 'resetChanges').mockReturnThis();
|
jest.spyOn(controller, 'resetChanges').mockReturnThis();
|
||||||
jest.spyOn(controller.$state, 'go').mockReturnThis();
|
jest.spyOn(controller.vnApp, 'getUrl').mockReturnThis();
|
||||||
|
Object.defineProperty(window, 'location', {
|
||||||
|
value: {
|
||||||
|
href: () => {}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
jest.spyOn(controller.window.location, 'href');
|
||||||
|
|
||||||
const newEmptySale = {quantity: 10};
|
const newEmptySale = {quantity: 10};
|
||||||
controller.sales.push(newEmptySale);
|
controller.sales.push(newEmptySale);
|
||||||
const firstSale = controller.sales[0];
|
const firstSale = controller.sales[0];
|
||||||
|
const claimId = 1;
|
||||||
firstSale.checked = true;
|
firstSale.checked = true;
|
||||||
|
|
||||||
const expectedParams = {ticketId: 1, sales: [firstSale]};
|
const expectedParams = {ticketId: 1, sales: [firstSale]};
|
||||||
$httpBackend.expect('POST', `Claims/createFromSales`, expectedParams).respond(200, {id: 1});
|
$httpBackend.expect('POST', `Claims/createFromSales`, expectedParams).respond(200, {id: claimId});
|
||||||
controller.onCreateClaimAccepted();
|
controller.onCreateClaimAccepted();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.resetChanges).toHaveBeenCalledWith();
|
expect(controller.resetChanges).toHaveBeenCalledWith();
|
||||||
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.basicData', {id: 1});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue