salix/modules/client/front/index/index.spec.js

29 lines
897 B
JavaScript
Raw Normal View History

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;
let controller;
beforeEach(ngModule('client'));
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});
}));
describe('filterTickets()', () => {
it('should navigate to the ticket index using params as filter', () => {
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');
controller.filterTickets(client, event);
2019-11-10 12:10:52 +00:00
expect($state.go).toHaveBeenCalledWith('ticket.index', jasmine.any(Object));
});
});
});