#2131 jest.spyOn
gitea/salix/2131_jest_spyOn This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-02-26 15:02:47 +01:00
parent aedd551371
commit 0fd012930e
5 changed files with 5 additions and 5 deletions

View File

@ -22,7 +22,7 @@ describe('Item Component vnClaimDescriptor', () => {
}; };
const serializedParams = $httpParamSerializer(params); const serializedParams = $httpParamSerializer(params);
let expectedPath = `api/report/claim-pickup-order?${serializedParams}`; let expectedPath = `api/report/claim-pickup-order?${serializedParams}`;
jest.spyOn(window, 'open'); jest.spyOn(window, 'open').mockReturnThis();
controller.showPickupOrder(); controller.showPickupOrder();
expect(window.open).toHaveBeenCalledWith(expectedPath); expect(window.open).toHaveBeenCalledWith(expectedPath);

View File

@ -31,7 +31,7 @@ describe('Client', () => {
it('should apply the filters on he models and get the client balance', () => { it('should apply the filters on he models and get the client balance', () => {
controller._companyId = 442; controller._companyId = 442;
controller.$stateParams.id = 101; controller.$stateParams.id = 101;
jest.spyOn(controller, 'getBalances'); jest.spyOn(controller, 'getBalances').mockReturnThis();
jest.spyOn(controller.$.model, 'applyFilter').mockReturnValue(Promise.resolve()); jest.spyOn(controller.$.model, 'applyFilter').mockReturnValue(Promise.resolve());
jest.spyOn(controller.$.riskModel, 'applyFilter').mockReturnValue(Promise.resolve()); jest.spyOn(controller.$.riskModel, 'applyFilter').mockReturnValue(Promise.resolve());

View File

@ -26,7 +26,7 @@ describe('Entry Component vnEntryDescriptor', () => {
}; };
const serializedParams = $httpParamSerializer(params); const serializedParams = $httpParamSerializer(params);
let expectedPath = `api/report/entry-order?${serializedParams}`; let expectedPath = `api/report/entry-order?${serializedParams}`;
jest.spyOn(window, 'open'); jest.spyOn(window, 'open').mockReturnThis();
controller.showEntryReport(); controller.showEntryReport();
expect(window.open).toHaveBeenCalledWith(expectedPath); expect(window.open).toHaveBeenCalledWith(expectedPath);

View File

@ -119,7 +119,7 @@ describe('Route', () => {
describe('goToBuscaman()', () => { describe('goToBuscaman()', () => {
it('should open buscaman with the given arguments', () => { it('should open buscaman with the given arguments', () => {
jest.spyOn(window, 'open'); jest.spyOn(window, 'open').mockReturnThis();
const expectedUrl = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=46460 Av Espioca 100+to:n19 London my street'; const expectedUrl = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=46460 Av Espioca 100+to:n19 London my street';
controller.route = {vehicleFk: 1}; controller.route = {vehicleFk: 1};
const url = `Routes/${controller.route.vehicleFk}/getDeliveryPoint`; const url = `Routes/${controller.route.vehicleFk}/getDeliveryPoint`;

View File

@ -90,7 +90,7 @@ describe('Ticket Component vnTicketDescriptor', () => {
}; };
const serializedParams = $httpParamSerializer(params); const serializedParams = $httpParamSerializer(params);
let expectedPath = `api/report/delivery-note?${serializedParams}`; let expectedPath = `api/report/delivery-note?${serializedParams}`;
jest.spyOn(window, 'open'); jest.spyOn(window, 'open').mockReturnThis();
controller.showDeliveryNote(); controller.showDeliveryNote();
expect(window.open).toHaveBeenCalledWith(expectedPath); expect(window.open).toHaveBeenCalledWith(expectedPath);