salix/modules/claim/front/development/index.spec.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

import './index.js';
import watcher from 'core/mocks/watcher';
import crudModel from 'core/mocks/crud-model';
describe('Claim', () => {
describe('Component vnClaimDevelopment', () => {
let controller;
let $scope;
beforeEach(ngModule('claim'));
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$scope.watcher = watcher;
$scope.model = crudModel;
2020-03-16 10:58:14 +00:00
const $element = angular.element('<vn-claim-development></vn-claim-development>');
controller = $componentController('vnClaimDevelopment', {$element, $scope});
}));
describe('onSubmit()', () => {
it(`should redirect to 'claim.card.action' state`, () => {
2020-03-16 10:58:14 +00:00
jest.spyOn(controller.aclService, 'hasAny').mockReturnValue(true);
2020-02-26 12:22:52 +00:00
jest.spyOn(controller.$state, 'go');
2020-03-16 10:58:14 +00:00
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.action');
});
});
});
});