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

41 lines
1.2 KiB
JavaScript

import './index';
import watcher from 'core/mocks/watcher';
xdescribe('Agency', () => {
describe('Component vnZoneCreate', () => {
let $scope;
let $state;
let controller;
beforeEach(ngModule('agency'));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = watcher;
$scope.watcher.submit = () => {
return {
then: callback => {
callback({data: {id: 1234}});
}
};
};
controller = $componentController('vnZoneCreate', {$scope});
}));
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});
});
});
});
});