2019-09-30 09:47:39 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('Client index', () => {
|
|
|
|
let $scope;
|
|
|
|
let controller;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('client'));
|
2019-09-30 09:47:39 +00:00
|
|
|
|
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, $state) => {
|
|
|
|
$scope = $rootScope.$new();
|
|
|
|
controller = $componentController('vnClientIndex', {$scope, $state});
|
|
|
|
}));
|
|
|
|
|
2019-09-30 11:16:31 +00:00
|
|
|
describe('filterTickets()', () => {
|
|
|
|
it('should navigate to the ticket index using params as filter', () => {
|
2019-09-30 09:47:39 +00:00
|
|
|
const client = {id: 101};
|
|
|
|
const event = {preventDefault: () => {}};
|
|
|
|
spyOn(event, 'preventDefault');
|
|
|
|
spyOn(controller.$state, 'go');
|
|
|
|
|
|
|
|
controller.filterTickets(client, event);
|
|
|
|
|
|
|
|
expect(event.preventDefault).toHaveBeenCalledWith();
|
|
|
|
expect(controller.$state.go).toHaveBeenCalledWith('ticket.index', jasmine.any(Object));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|