import './index'; describe('Client index', () => { let $state; let $scope; let controller; beforeEach(ngModule('client')); beforeEach(inject(($componentController, _$state_, $rootScope) => { $state = _$state_; $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnClientIndex', {$element, $scope}); })); describe('filterTickets()', () => { it('should navigate to the ticket index using params as filter', () => { const client = {id: 1101}; const event = new MouseEvent('click', {cancelable: true}); jest.spyOn($state, 'go'); controller.filterTickets(client, event); expect($state.go).toHaveBeenCalledWith('ticket.index', jasmine.any(Object)); }); }); });