Fixed test
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Jorge Padawan 2021-02-17 13:32:09 +01:00
parent 29ca6c52af
commit d5e53909c6
1 changed files with 7 additions and 6 deletions

View File

@ -11,7 +11,7 @@ describe('Supplier Component vnSupplierAccount', () => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$scope.bankEntity = {
show: () => {}
open: () => {}
};
$element = angular.element('<vn-supplier-accounts></supplier-accounts>');
controller = $componentController('vnSupplierAccount', {$element, $scope});
@ -28,26 +28,27 @@ describe('Supplier Component vnSupplierAccount', () => {
preventDefault: () => {}
};
jest.spyOn(event, 'preventDefault');
jest.spyOn(controller.$.bankEntity, 'show');
jest.spyOn(controller.$.bankEntity, 'open');
controller.showBankEntity(event);
expect(event.preventDefault).not.toHaveBeenCalledWith();
expect(controller.$.bankEntity.show).not.toHaveBeenCalledWith();
expect(controller.$.bankEntity.open).not.toHaveBeenCalledWith();
});
it('should call preventDefault() and show() when the default is not prevented', () => {
it('should call preventDefault() and open() when the default is not prevented', () => {
const event = {
defaultPrevented: false,
preventDefault: () => {}
};
jest.spyOn(event, 'preventDefault');
jest.spyOn(controller.$.bankEntity, 'show');
jest.spyOn(controller.$.bankEntity, 'open');
controller.showBankEntity(event);
expect(event.preventDefault).toHaveBeenCalledWith();
expect(controller.$.bankEntity.show).toHaveBeenCalledWith();
expect(controller.$.bankEntity.open).toHaveBeenCalledWith();
});
it('should request to create a new bank entity', () => {