salix/client/client/src/greuge/create/greuge-create.spec.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import './index';
2018-01-15 08:39:06 +00:00
describe('Client', () => {
describe('Component vnClientGreugeCreate', () => {
let $componentController;
let $scope;
let $state;
let controller;
beforeEach(() => {
angular.mock.module('client');
});
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => {
$componentController = _$componentController_;
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
submit: () => {
return {
then: callback => {
callback();
}
};
}
};
controller = $componentController('vnClientGreugeCreate', {$scope: $scope});
}));
describe('onSubmit()', () => {
it('should call the function go() on $state to go to the greuges list', () => {
spyOn($state, 'go');
controller.onSubmit();
2018-05-23 12:26:51 +00:00
expect(controller.$state.go).toHaveBeenCalledWith('client.card.greuge.list');
2018-01-15 08:39:06 +00:00
});
});
});
});