31 lines
854 B
JavaScript
31 lines
854 B
JavaScript
|
import './index';
|
||
|
import watcher from 'core/mocks/watcher';
|
||
|
|
||
|
describe('Travel Component vnTravelCreate', () => {
|
||
|
let $element;
|
||
|
let $scope;
|
||
|
let $state;
|
||
|
let controller;
|
||
|
|
||
|
beforeEach(ngModule('travel'));
|
||
|
|
||
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
|
||
|
$scope = $rootScope.$new();
|
||
|
$state = _$state_;
|
||
|
$scope.watcher = watcher;
|
||
|
$element = angular.element('<div></div>');
|
||
|
controller = $componentController('vnTravelCreate', {$element, $scope});
|
||
|
}));
|
||
|
|
||
|
describe('onSubmit()', () => {
|
||
|
it(`should call submit() on the watcher then expect a callback`, () => {
|
||
|
spyOn($state, 'go');
|
||
|
|
||
|
controller.onSubmit();
|
||
|
|
||
|
expect(controller.$state.go).toHaveBeenCalledWith('travel.card.summary', {id: 1234});
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
|