test: fix ticket redirect to lilium
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
4e831dc1bd
commit
c768fa113e
|
@ -295,20 +295,26 @@ describe('Ticket', () => {
|
|||
describe('onCreateClaimAccepted()', () => {
|
||||
it('should perform a query and call window open', () => {
|
||||
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};
|
||||
controller.sales.push(newEmptySale);
|
||||
const firstSale = controller.sales[0];
|
||||
const claimId = 1;
|
||||
firstSale.checked = true;
|
||||
|
||||
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();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.resetChanges).toHaveBeenCalledWith();
|
||||
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.basicData', {id: 1});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue