From 21701601e381147093490da6762e859df9ed21c5 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 27 Jul 2022 13:01:03 +0200 Subject: [PATCH] fix: update frontTest --- modules/shelving/front/create/index.spec.js | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/modules/shelving/front/create/index.spec.js b/modules/shelving/front/create/index.spec.js index 1642afc52..0bdde9145 100644 --- a/modules/shelving/front/create/index.spec.js +++ b/modules/shelving/front/create/index.spec.js @@ -1,17 +1,26 @@ import './index'; -import watcher from 'core/mocks/watcher'; -fdescribe('Shelving', () => { +describe('Shelving', () => { describe('Component vnShelvingCreate', () => { + let $scope; + let $state; let controller; - let $element; beforeEach(ngModule('shelving')); - beforeEach(inject(($componentController, $rootScope) => { - const $scope = $rootScope.$new(); - $scope.watcher = watcher; - $element = angular.element(''); + beforeEach(inject(($componentController, $rootScope, _$state_) => { + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = { + submit: () => { + return { + then: callback => { + callback({data: {id: 1}}); + } + }; + } + }; + const $element = angular.element(''); controller = $componentController('vnShelvingCreate', {$element, $scope}); controller.$params = {}; })); @@ -22,7 +31,7 @@ fdescribe('Shelving', () => { controller.onSubmit(); - expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1234}); + expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1}); }); }); });