fix: update frontTest
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-07-27 13:01:03 +02:00
parent 26f8996936
commit 21701601e3
1 changed files with 17 additions and 8 deletions

View File

@ -1,17 +1,26 @@
import './index'; import './index';
import watcher from 'core/mocks/watcher';
fdescribe('Shelving', () => { describe('Shelving', () => {
describe('Component vnShelvingCreate', () => { describe('Component vnShelvingCreate', () => {
let $scope;
let $state;
let controller; let controller;
let $element;
beforeEach(ngModule('shelving')); beforeEach(ngModule('shelving'));
beforeEach(inject(($componentController, $rootScope) => { beforeEach(inject(($componentController, $rootScope, _$state_) => {
const $scope = $rootScope.$new(); $scope = $rootScope.$new();
$scope.watcher = watcher; $state = _$state_;
$element = angular.element('<vn-shelving-create></vn-shelving-create>'); $scope.watcher = {
submit: () => {
return {
then: callback => {
callback({data: {id: 1}});
}
};
}
};
const $element = angular.element('<vn-shelving-create></vn-shelving-create>');
controller = $componentController('vnShelvingCreate', {$element, $scope}); controller = $componentController('vnShelvingCreate', {$element, $scope});
controller.$params = {}; controller.$params = {};
})); }));
@ -22,7 +31,7 @@ fdescribe('Shelving', () => {
controller.onSubmit(); controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1234}); expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1});
}); });
}); });
}); });