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

32 lines
1.0 KiB
JavaScript

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(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$scope.watcher = watcher;
$scope.model = crudModel;
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`, () => {
jest.spyOn(controller.aclService, 'hasAny').mockReturnValue(true);
jest.spyOn(controller.$state, 'go');
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.action');
});
});
});
});