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

26 lines
732 B
JavaScript
Raw Normal View History

import './index';
describe('Client index', () => {
2019-11-10 12:10:52 +00:00
let $state;
let controller;
beforeEach(ngModule('client'));
2019-11-10 12:10:52 +00:00
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};
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));
});
});
});