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

30 lines
974 B
JavaScript
Raw Normal View History

2022-05-24 10:50:22 +00:00
import './index';
2022-07-20 11:41:33 +00:00
import watcher from 'core/mocks/watcher';
2022-05-24 10:50:22 +00:00
2022-07-20 11:41:33 +00:00
fdescribe('Shelving', () => {
describe('Component vnShelvingCreate', () => {
2022-05-24 10:50:22 +00:00
let controller;
2022-07-20 11:41:33 +00:00
let $element;
2022-05-24 10:50:22 +00:00
2022-07-20 11:41:33 +00:00
beforeEach(ngModule('shelving'));
2022-05-24 10:50:22 +00:00
2022-07-20 11:41:33 +00:00
beforeEach(inject(($componentController, $rootScope) => {
const $scope = $rootScope.$new();
$scope.watcher = watcher;
$element = angular.element('<vn-shelving-create></vn-shelving-create>');
controller = $componentController('vnShelvingCreate', {$element, $scope});
controller.$params = {};
2022-05-24 10:50:22 +00:00
}));
describe('onSubmit()', () => {
2022-07-20 11:41:33 +00:00
it(`should redirect to basic data by calling the $state.go function`, () => {
jest.spyOn(controller.$state, 'go');
2022-05-24 10:50:22 +00:00
2022-07-20 11:41:33 +00:00
controller.onSubmit();
2022-05-24 10:50:22 +00:00
2022-07-20 11:41:33 +00:00
expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1234});
2022-05-24 10:50:22 +00:00
});
});
});
});