Commit e5e532b1f8eaf3288eba61d3d0cd990718696cf7

Authored by Luigi
1 parent a08587385b
Exists in master

Arreglo de errores Test

Showing 1 changed file with 49 additions and 11 deletions   Show diff stats
spec/controllerSpec.js
... ... @@ -25,6 +25,7 @@ describe('Controladores abm precios condiciones', function() {
25 25 focaAbmPreciosCondicionesService: {},
26 26 $location: {},
27 27 focaModalService: {},
  28 + $localStorage: {},
28 29 focaBotoneraLateralService: {},
29 30 $timeout: timeout
30 31 });
... ... @@ -42,6 +43,7 @@ describe('Controladores abm precios condiciones', function() {
42 43 $scope: scope,
43 44 focaAbmPreciosCondicionesService: {},
44 45 $location: $location,
  46 + $localStorage: {},
45 47 focaModalService: {},
46 48 focaBotoneraLateralService: {},
47 49 $timeout: timeout
... ... @@ -67,6 +69,7 @@ describe('Controladores abm precios condiciones', function() {
67 69 $scope: scope,
68 70 focaAbmPreciosCondicionesService: {},
69 71 $location: {},
  72 + $localStorage: {},
70 73 focaModalService: focaModalService,
71 74 focaBotoneraLateralService: {},
72 75 $timeout: timeout
... ... @@ -94,6 +97,7 @@ describe('Controladores abm precios condiciones', function() {
94 97 $scope: scope,
95 98 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
96 99 $location: {},
  100 + $localStorage: {},
97 101 focaModalService: focaModalService,
98 102 focaBotoneraLateralService: {},
99 103 $timeout: timeout
... ... @@ -123,6 +127,7 @@ describe('Controladores abm precios condiciones', function() {
123 127 $scope: scope,
124 128 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
125 129 $location: {},
  130 + $localStorage: {},
126 131 focaModalService: {},
127 132 focaBotoneraLateralService: {},
128 133 $timeout: timeout
... ... @@ -143,7 +148,9 @@ describe('Controladores abm precios condiciones', function() {
143 148 it('Existe el controlador focaAbmPrecioCondicionController', function() {
144 149 //act
145 150 var controlador = $controller('focaAbmPrecioCondicionController', {
146   - $scope: {},
  151 + $scope: {
  152 + $watch: function(){}
  153 + },
147 154 focaAbmPreciosCondicionesService: {
148 155 obtenerPrecioCondicion: function() {
149 156 return {
... ... @@ -157,6 +164,7 @@ describe('Controladores abm precios condiciones', function() {
157 164 focaModalService: {},
158 165 $timeout: timeout,
159 166 $uibModal: {},
  167 + $localStorage: {},
160 168 $window: {}
161 169 });
162 170  
... ... @@ -167,7 +175,11 @@ describe('Controladores abm precios condiciones', function() {
167 175 it('La funcion $scope.cancelar lleva a la ruta correcta', function() {
168 176 inject(function($location) {
169 177 //arrange
170   - var scope = {};
  178 + var scope = {
  179 + $watch: function() {},
  180 + salir: function() {},
  181 + formPrecioCondicion: ''
  182 + };
171 183 $controller('focaAbmPrecioCondicionController', {
172 184 $scope: scope,
173 185 focaAbmPreciosCondicionesService: {
... ... @@ -180,6 +192,7 @@ describe('Controladores abm precios condiciones', function() {
180 192 focaBotoneraLateralService: {},
181 193 $routeParams: {},
182 194 $location: $location,
  195 + $localStorage: {},
183 196 focaModalService: {},
184 197 $timeout: timeout,
185 198 $uibModal: {},
... ... @@ -187,7 +200,7 @@ describe('Controladores abm precios condiciones', function() {
187 200 });
188 201  
189 202 //act
190   - scope.cancelar();
  203 + scope.salir();
191 204  
192 205 //assert
193 206 expect($location.url()).toEqual('/precio-condicion');
... ... @@ -197,7 +210,9 @@ describe('Controladores abm precios condiciones', function() {
197 210 it('La funcion $scope.guardar llama a servicio.guardarPrecioCondicion', function() {
198 211 inject(function($location) {
199 212 //arrange
200   - var scope = {};
  213 + var scope = {
  214 + $watch: function() { }
  215 + };
201 216 var focaAbmPreciosCondicionesService = {
202 217 obtenerPrecioCondicion: function() {
203 218 return {
... ... @@ -217,13 +232,21 @@ describe('Controladores abm precios condiciones', function() {
217 232 focaBotoneraLateralService: {},
218 233 $routeParams: {},
219 234 $location: $location,
220   - focaModalService: {},
  235 + focaModalService: {
  236 + alert: function() {}
  237 + },
221 238 $timeout: timeout,
222 239 $uibModal: {},
  240 + $localStorage: {},
223 241 $window: window
224 242 });
225 243 var promesaGuardarPrecioCondicion = Promise.resolve(true);
226   - scope.precioCondicion = { listaPrecio: {} };
  244 + scope.precioCondicion = {
  245 + listaPrecio: {},
  246 + nombre: true,
  247 + descripcion: true,
  248 + idListaPrecio: true
  249 + };
227 250  
228 251 //act
229 252 //spyOn(window, 'location').and.returnValue({ assign: function() {} });
... ... @@ -238,7 +261,9 @@ describe('Controladores abm precios condiciones', function() {
238 261  
239 262 it('La funcion $scope.solicitarConfirmacionPlazoPago levanta modal confirm', function() {
240 263 //act
241   - var scope = {};
  264 + var scope = {
  265 + $watch: function() {}
  266 + };
242 267 var focaModalService = {
243 268 confirm: function() { }
244 269 };
... ... @@ -257,6 +282,7 @@ describe('Controladores abm precios condiciones', function() {
257 282 focaModalService: focaModalService,
258 283 $timeout: timeout,
259 284 $uibModal: {},
  285 + $localStorage: {},
260 286 $window: {}
261 287 });
262 288  
... ... @@ -271,7 +297,9 @@ describe('Controladores abm precios condiciones', function() {
271 297  
272 298 it('La funcion $scope.solicitarConfirmacionPlazoPago borra al dar ok', function(done) {
273 299 //act
274   - var scope = {};
  300 + var scope = {
  301 + $watch: function() { }
  302 + };
275 303 var focaModalService = {
276 304 confirm: function() { }
277 305 };
... ... @@ -291,6 +319,7 @@ describe('Controladores abm precios condiciones', function() {
291 319 $location: {},
292 320 focaModalService: focaModalService,
293 321 $timeout: timeout,
  322 + $localStorage: {},
294 323 $uibModal: {},
295 324 $window: {}
296 325 });
... ... @@ -313,7 +342,9 @@ describe('Controladores abm precios condiciones', function() {
313 342  
314 343 it('La funcion $scope.seleccionarListaPrecio levanta modal', function() {
315 344 //arrange
316   - var scope = {};
  345 + var scope = {
  346 + $watch: function() {}
  347 + };
317 348 var uibModal = {
318 349 open: function() { }
319 350 };
... ... @@ -333,6 +364,7 @@ describe('Controladores abm precios condiciones', function() {
333 364 focaModalService: {},
334 365 $timeout: timeout,
335 366 $uibModal: uibModal,
  367 + $localStorage: {},
336 368 $window: {}
337 369 });
338 370  
... ... @@ -346,7 +378,9 @@ describe('Controladores abm precios condiciones', function() {
346 378  
347 379 it('La funcion $scope.verProductosListaPrecio levanta modal', function() {
348 380 //arrange
349   - var scope = {};
  381 + var scope = {
  382 + $watch: function() {}
  383 + };
350 384 var uibModal = {
351 385 open: function() { }
352 386 };
... ... @@ -366,6 +400,7 @@ describe('Controladores abm precios condiciones', function() {
366 400 focaModalService: {},
367 401 $timeout: timeout,
368 402 $uibModal: uibModal,
  403 + $localStorage: {},
369 404 $window: {}
370 405 });
371 406 scope.precioCondicion = {
... ... @@ -381,7 +416,9 @@ describe('Controladores abm precios condiciones', function() {
381 416  
382 417 it('la función next suma uno a $scope.focused', function() {
383 418 //arrange
384   - var scope = {};
  419 + var scope = {
  420 + $watch: function() {}
  421 + };
385 422 var focaAbmPreciosCondicionesService = {
386 423 obtenerPrecioCondicion: function() {
387 424 return {
... ... @@ -398,6 +435,7 @@ describe('Controladores abm precios condiciones', function() {
398 435 focaModalService: {},
399 436 $timeout: timeout,
400 437 $uibModal: {},
  438 + $localStorage: {},
401 439 $window: {}
402 440 });
403 441