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

26 lines
732 B
JavaScript

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