salix/modules/agency/front/create/index.spec.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-09-19 13:05:07 +00:00
import './index';
2018-12-27 11:54:16 +00:00
import watcher from 'core/mocks/watcher';
2018-09-19 13:05:07 +00:00
2019-01-21 10:45:53 +00:00
xdescribe('Agency', () => {
2018-09-19 13:05:07 +00:00
describe('Component vnZoneCreate', () => {
let $scope;
let $state;
let controller;
beforeEach(ngModule('agency'));
2018-09-19 13:05:07 +00:00
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
2018-09-19 13:05:07 +00:00
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = watcher;
2018-09-24 12:51:27 +00:00
$scope.watcher.submit = () => {
return {
then: callback => {
callback({data: {id: 1234}});
}
};
};
controller = $componentController('vnZoneCreate', {$scope});
2018-09-19 13:05:07 +00:00
}));
describe('onSubmit()', () => {
it(`should call submit() on the watcher then expect a callback`, () => {
spyOn($state, 'go');
controller.zone = {
name: 'Zone One'
};
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('zone.card.basicData', {id: 1234});
});
});
});
});