2019-09-30 09:47:39 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('Client index', () => {
|
2019-11-10 12:10:52 +00:00
|
|
|
let $state;
|
2020-03-17 10:17:50 +00:00
|
|
|
let $scope;
|
2019-09-30 09:47:39 +00:00
|
|
|
let controller;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('client'));
|
2019-09-30 09:47:39 +00:00
|
|
|
|
2020-03-17 10:17:50 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope) => {
|
2019-11-10 12:10:52 +00:00
|
|
|
$state = _$state_;
|
2020-03-17 10:17:50 +00:00
|
|
|
$scope = $rootScope.$new();
|
|
|
|
const $element = angular.element('<vn-client-index></vn-client-index>');
|
|
|
|
controller = $componentController('vnClientIndex', {$element, $scope});
|
2019-09-30 09:47:39 +00:00
|
|
|
}));
|
|
|
|
|
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};
|
2019-11-10 12:10:52 +00:00
|
|
|
const event = new MouseEvent('click', {cancelable: true});
|
2020-02-26 12:22:52 +00:00
|
|
|
jest.spyOn($state, 'go');
|
2019-09-30 09:47:39 +00:00
|
|
|
|
|
|
|
controller.filterTickets(client, event);
|
|
|
|
|
2019-11-10 12:10:52 +00:00
|
|
|
expect($state.go).toHaveBeenCalledWith('ticket.index', jasmine.any(Object));
|
2019-09-30 09:47:39 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|