Commit d12bccc382e89a6045aacee055ed2e4628e44d37
1 parent
10f053b789
Exists in
master
ok test
Showing
3 changed files
with
536 additions
and
179 deletions
Show diff stats
spec/controllerSpec.js
... | ... | @@ -25,7 +25,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
25 | 25 | |
26 | 26 | it('La función seleccionarNotaPedido levanta modal', function() { |
27 | 27 | //arrange |
28 | - var scope = {}; | |
28 | + var scope = { | |
29 | + $watch: function() { }, | |
30 | + $broadcast: function() { } | |
31 | + }; | |
29 | 32 | var uibModal = { |
30 | 33 | open: function() { } |
31 | 34 | }; |
... | ... | @@ -37,6 +40,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
37 | 40 | $filter: filter, |
38 | 41 | $timeout: timeout, |
39 | 42 | crearNotaPedidoService: { |
43 | + getNumeroNotaPedido: function() { | |
44 | + return { | |
45 | + then: function() { } | |
46 | + }; | |
47 | + }, | |
40 | 48 | getBotonera: function() { }, |
41 | 49 | getCotizacionByIdMoneda: function() { |
42 | 50 | return { |
... | ... | @@ -53,8 +61,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
53 | 61 | focaSeguimientoService: {}, |
54 | 62 | APP: {}, |
55 | 63 | focaLoginService: {}, |
56 | - $localStorage: {}, | |
57 | - $watch: function() { } | |
64 | + $localStorage: {} | |
58 | 65 | }); |
59 | 66 | var respuesta = { result: { then: function() { } } }; |
60 | 67 | |
... | ... | @@ -68,7 +75,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
68 | 75 | |
69 | 76 | it('La función seleccionarNotaPedido llama a broadCast en promesa', function(done) { |
70 | 77 | //arrange |
71 | - var scope = {}; | |
78 | + var scope = { | |
79 | + $watch: function() { }, | |
80 | + $broadcast: function() { } | |
81 | + }; | |
72 | 82 | var uibModal = { |
73 | 83 | open: function() { } |
74 | 84 | }; |
... | ... | @@ -80,6 +90,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
80 | 90 | $filter: filter, |
81 | 91 | $timeout: timeout, |
82 | 92 | crearNotaPedidoService: { |
93 | + getNumeroNotaPedido: function() { | |
94 | + return { | |
95 | + then: function() { } | |
96 | + }; | |
97 | + }, | |
83 | 98 | getBotonera: function() { }, |
84 | 99 | getCotizacionByIdMoneda: function() { |
85 | 100 | return { |
... | ... | @@ -99,8 +114,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
99 | 114 | focaSeguimientoService: {}, |
100 | 115 | APP: {}, |
101 | 116 | focaLoginService: {}, |
102 | - $localStorage: {}, | |
103 | - $watch: function() { } | |
117 | + $localStorage: {} | |
104 | 118 | }); |
105 | 119 | var notaPedido = { |
106 | 120 | cotizacion: { |
... | ... | @@ -109,7 +123,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
109 | 123 | cliente: {}, |
110 | 124 | vendedor: {}, |
111 | 125 | proveedor: {}, |
112 | - notaPedidoPlazo: {}, | |
126 | + notaPedidoPlazo: [], | |
113 | 127 | notaPedidoPuntoDescarga: [] |
114 | 128 | }; |
115 | 129 | var respuesta = { result: Promise.resolve(notaPedido) }; |
... | ... | @@ -131,7 +145,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
131 | 145 | |
132 | 146 | it('función seleccionarProductos muestra alerta cuando idLista undefined', function() { |
133 | 147 | //arrange |
134 | - var scope = {}; | |
148 | + var scope = { | |
149 | + $watch: function() { }, | |
150 | + $broadcast: function() { } | |
151 | + }; | |
135 | 152 | var focaModalService = { |
136 | 153 | alert: function() { } |
137 | 154 | }; |
... | ... | @@ -143,6 +160,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
143 | 160 | $filter: filter, |
144 | 161 | $timeout: timeout, |
145 | 162 | crearNotaPedidoService: { |
163 | + getNumeroNotaPedido: function() { | |
164 | + return { | |
165 | + then: function() { } | |
166 | + }; | |
167 | + }, | |
146 | 168 | getBotonera: function() { }, |
147 | 169 | getCotizacionByIdMoneda: function() { |
148 | 170 | return { |
... | ... | @@ -159,8 +181,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
159 | 181 | focaSeguimientoService: {}, |
160 | 182 | APP: {}, |
161 | 183 | focaLoginService: {}, |
162 | - $localStorage: {}, | |
163 | - $watch: function() { } | |
184 | + $localStorage: {} | |
164 | 185 | }); |
165 | 186 | |
166 | 187 | //act |
... | ... | @@ -175,7 +196,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
175 | 196 | |
176 | 197 | it('función seleccionarProductos abre modal', function() { |
177 | 198 | //arrange |
178 | - var scope = {}; | |
199 | + var scope = { | |
200 | + $watch: function() { }, | |
201 | + $broadcast: function() { } | |
202 | + }; | |
179 | 203 | var uibModal = { |
180 | 204 | open: function() { } |
181 | 205 | }; |
... | ... | @@ -187,6 +211,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
187 | 211 | $filter: filter, |
188 | 212 | $timeout: timeout, |
189 | 213 | crearNotaPedidoService: { |
214 | + getNumeroNotaPedido: function() { | |
215 | + return { | |
216 | + then: function() { } | |
217 | + }; | |
218 | + }, | |
190 | 219 | getBotonera: function() { }, |
191 | 220 | getCotizacionByIdMoneda: function() { |
192 | 221 | return { |
... | ... | @@ -203,13 +232,14 @@ describe('Controladores módulo crear nota de pedido', function() { |
203 | 232 | focaSeguimientoService: {}, |
204 | 233 | APP: {}, |
205 | 234 | focaLoginService: {}, |
206 | - $localStorage: {}, | |
207 | - $watch: function() { } | |
235 | + $localStorage: {} | |
208 | 236 | }); |
209 | 237 | scope.idLista = true; |
210 | 238 | scope.notaPedido = { |
211 | - cotizacion: {}, | |
212 | - moneda: {} | |
239 | + cotizacion: { | |
240 | + moneda: {} | |
241 | + }, | |
242 | + | |
213 | 243 | }; |
214 | 244 | var respuesta = { result: {then: function() { } } }; |
215 | 245 | |
... | ... | @@ -225,7 +255,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
225 | 255 | 'undefined', function() |
226 | 256 | { |
227 | 257 | //arrange |
228 | - var scope = {}; | |
258 | + var scope = { | |
259 | + $watch: function() { }, | |
260 | + $broadcast: function() { } | |
261 | + }; | |
229 | 262 | var focaModalService = { |
230 | 263 | alert: function() { } |
231 | 264 | }; |
... | ... | @@ -237,6 +270,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
237 | 270 | $filter: filter, |
238 | 271 | $timeout: timeout, |
239 | 272 | crearNotaPedidoService: { |
273 | + getNumeroNotaPedido: function() { | |
274 | + return { | |
275 | + then: function() { } | |
276 | + }; | |
277 | + }, | |
240 | 278 | getBotonera: function() { }, |
241 | 279 | getCotizacionByIdMoneda: function() { |
242 | 280 | return { |
... | ... | @@ -253,8 +291,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
253 | 291 | focaSeguimientoService: {}, |
254 | 292 | APP: {}, |
255 | 293 | focaLoginService: {}, |
256 | - $localStorage: {}, | |
257 | - $watch: function() { } | |
294 | + $localStorage: {} | |
258 | 295 | }); |
259 | 296 | scope.idLista = true; |
260 | 297 | scope.notaPedido = { |
... | ... | @@ -272,7 +309,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
272 | 309 | |
273 | 310 | it('función seleccionarPuntosDeDescarga abre modal', function() { |
274 | 311 | //arrange |
275 | - var scope = {}; | |
312 | + var scope = { | |
313 | + $watch: function() { }, | |
314 | + $broadcast: function() { } | |
315 | + }; | |
276 | 316 | var uibModal = { |
277 | 317 | open: function() { } |
278 | 318 | }; |
... | ... | @@ -284,6 +324,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
284 | 324 | $filter: filter, |
285 | 325 | $timeout: timeout, |
286 | 326 | crearNotaPedidoService: { |
327 | + getNumeroNotaPedido: function() { | |
328 | + return { | |
329 | + then: function() { } | |
330 | + }; | |
331 | + }, | |
287 | 332 | getBotonera: function() { }, |
288 | 333 | getCotizacionByIdMoneda: function() { |
289 | 334 | return { |
... | ... | @@ -300,8 +345,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
300 | 345 | focaSeguimientoService: {}, |
301 | 346 | APP: {}, |
302 | 347 | focaLoginService: {}, |
303 | - $localStorage: {}, | |
304 | - $watch: function() { } | |
348 | + $localStorage: {} | |
305 | 349 | }); |
306 | 350 | scope.idLista = true; |
307 | 351 | scope.notaPedido = { |
... | ... | @@ -320,7 +364,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
320 | 364 | |
321 | 365 | it('función seleccionarPuntosDeDescarga setea punto elegido', function(done) { |
322 | 366 | //arrange |
323 | - var scope = {}; | |
367 | + var scope = { | |
368 | + $watch: function() { }, | |
369 | + $broadcast: function() { } | |
370 | + }; | |
324 | 371 | var uibModal = { |
325 | 372 | open: function() { } |
326 | 373 | }; |
... | ... | @@ -332,6 +379,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
332 | 379 | $filter: filter, |
333 | 380 | $timeout: timeout, |
334 | 381 | crearNotaPedidoService: { |
382 | + getNumeroNotaPedido: function() { | |
383 | + return { | |
384 | + then: function() { } | |
385 | + }; | |
386 | + }, | |
335 | 387 | getBotonera: function() { }, |
336 | 388 | getCotizacionByIdMoneda: function() { |
337 | 389 | return { |
... | ... | @@ -348,13 +400,13 @@ describe('Controladores módulo crear nota de pedido', function() { |
348 | 400 | focaSeguimientoService: {}, |
349 | 401 | APP: {}, |
350 | 402 | focaLoginService: {}, |
351 | - $localStorage: {}, | |
352 | - $watch: function() { } | |
403 | + $localStorage: {} | |
353 | 404 | }); |
354 | 405 | scope.idLista = true; |
355 | 406 | scope.notaPedido = { |
356 | 407 | cliente: { COD: true }, |
357 | - domicilio: { id: true } | |
408 | + domicilio: { id: true }, | |
409 | + puntosDescarga: [] | |
358 | 410 | }; |
359 | 411 | var respuesta = []; |
360 | 412 | var promiseRespuesta = { result: Promise.resolve(respuesta) }; |
... | ... | @@ -373,7 +425,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
373 | 425 | |
374 | 426 | it('función seleccionarVendedor abre modal', function() { |
375 | 427 | //arrange |
376 | - var scope = {}; | |
428 | + var scope = { | |
429 | + $watch: function() { }, | |
430 | + $broadcast: function() { } | |
431 | + }; | |
377 | 432 | var focaModalService = { |
378 | 433 | modal: function() { } |
379 | 434 | }; |
... | ... | @@ -385,6 +440,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
385 | 440 | $filter: filter, |
386 | 441 | $timeout: timeout, |
387 | 442 | crearNotaPedidoService: { |
443 | + getNumeroNotaPedido: function() { | |
444 | + return { | |
445 | + then: function() { } | |
446 | + }; | |
447 | + }, | |
388 | 448 | getBotonera: function() { }, |
389 | 449 | getCotizacionByIdMoneda: function() { |
390 | 450 | return { |
... | ... | @@ -401,8 +461,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
401 | 461 | focaSeguimientoService: {}, |
402 | 462 | APP: {}, |
403 | 463 | focaLoginService: {}, |
404 | - $localStorage: {}, | |
405 | - $watch: function() { } | |
464 | + $localStorage: {} | |
406 | 465 | }); |
407 | 466 | scope.idLista = true; |
408 | 467 | scope.notaPedido = { |
... | ... | @@ -422,7 +481,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
422 | 481 | |
423 | 482 | it('función seleccionarVendedor setea vendedor y cabecera', function(done) { |
424 | 483 | //arrange |
425 | - var scope = {}; | |
484 | + var scope = { | |
485 | + $watch: function() { }, | |
486 | + $broadcast: function() { } | |
487 | + }; | |
426 | 488 | var focaModalService = { |
427 | 489 | modal: function() { } |
428 | 490 | }; |
... | ... | @@ -434,6 +496,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
434 | 496 | $filter: filter, |
435 | 497 | $timeout: timeout, |
436 | 498 | crearNotaPedidoService: { |
499 | + getNumeroNotaPedido: function() { | |
500 | + return { | |
501 | + then: function() { } | |
502 | + }; | |
503 | + }, | |
437 | 504 | getBotonera: function() { }, |
438 | 505 | getCotizacionByIdMoneda: function() { |
439 | 506 | return { |
... | ... | @@ -450,8 +517,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
450 | 517 | focaSeguimientoService: {}, |
451 | 518 | APP: {}, |
452 | 519 | focaLoginService: {}, |
453 | - $localStorage: {}, | |
454 | - $watch: function() { } | |
520 | + $localStorage: {} | |
455 | 521 | }); |
456 | 522 | scope.idLista = true; |
457 | 523 | scope.notaPedido = { |
... | ... | @@ -477,7 +543,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
477 | 543 | |
478 | 544 | it('función seleccionarProveedor abre modal', function() { |
479 | 545 | //arrange |
480 | - var scope = {}; | |
546 | + var scope = { | |
547 | + $watch: function() { }, | |
548 | + $broadcast: function() { } | |
549 | + }; | |
481 | 550 | var focaModalService = { |
482 | 551 | modal: function() { } |
483 | 552 | }; |
... | ... | @@ -489,6 +558,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
489 | 558 | $filter: filter, |
490 | 559 | $timeout: timeout, |
491 | 560 | crearNotaPedidoService: { |
561 | + getNumeroNotaPedido: function() { | |
562 | + return { | |
563 | + then: function() { } | |
564 | + }; | |
565 | + }, | |
492 | 566 | getBotonera: function() { }, |
493 | 567 | getCotizacionByIdMoneda: function() { |
494 | 568 | return { |
... | ... | @@ -505,8 +579,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
505 | 579 | focaSeguimientoService: {}, |
506 | 580 | APP: {}, |
507 | 581 | focaLoginService: {}, |
508 | - $localStorage: {}, | |
509 | - $watch: function() { } | |
582 | + $localStorage: {} | |
510 | 583 | }); |
511 | 584 | scope.notaPedido = {}; |
512 | 585 | |
... | ... | @@ -522,7 +595,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
522 | 595 | |
523 | 596 | it('función seleccionarProveedor setea vendedor y cabecera', function(done) { |
524 | 597 | //arrange |
525 | - var scope = {}; | |
598 | + var scope = { | |
599 | + $watch: function() { }, | |
600 | + $broadcast: function() { } | |
601 | + }; | |
526 | 602 | var focaModalService = { |
527 | 603 | modal: function() { } |
528 | 604 | }; |
... | ... | @@ -534,6 +610,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
534 | 610 | $filter: filter, |
535 | 611 | $timeout: timeout, |
536 | 612 | crearNotaPedidoService: { |
613 | + getNumeroNotaPedido: function() { | |
614 | + return { | |
615 | + then: function() { } | |
616 | + }; | |
617 | + }, | |
537 | 618 | getBotonera: function() { }, |
538 | 619 | getCotizacionByIdMoneda: function() { |
539 | 620 | return { |
... | ... | @@ -550,8 +631,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
550 | 631 | focaSeguimientoService: {}, |
551 | 632 | APP: {}, |
552 | 633 | focaLoginService: {}, |
553 | - $localStorage: {}, | |
554 | - $watch: function() { } | |
634 | + $localStorage: {} | |
555 | 635 | }); |
556 | 636 | |
557 | 637 | scope.notaPedido = {}; |
... | ... | @@ -574,7 +654,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
574 | 654 | |
575 | 655 | it('función seleccionarCliente abre alerta cuando no se elije vendedor', function() { |
576 | 656 | //arrange |
577 | - var scope = {}; | |
657 | + var scope = { | |
658 | + $watch: function() { }, | |
659 | + $broadcast: function() { } | |
660 | + }; | |
578 | 661 | var focaModalService = { |
579 | 662 | alert: function() { } |
580 | 663 | }; |
... | ... | @@ -586,6 +669,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
586 | 669 | $filter: filter, |
587 | 670 | $timeout: timeout, |
588 | 671 | crearNotaPedidoService: { |
672 | + getNumeroNotaPedido: function() { | |
673 | + return { | |
674 | + then: function() { } | |
675 | + }; | |
676 | + }, | |
589 | 677 | getBotonera: function() { }, |
590 | 678 | getCotizacionByIdMoneda: function() { |
591 | 679 | return { |
... | ... | @@ -602,8 +690,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
602 | 690 | focaSeguimientoService: {}, |
603 | 691 | APP: {}, |
604 | 692 | focaLoginService: {}, |
605 | - $localStorage: {}, | |
606 | - $watch: function() { } | |
693 | + $localStorage: {} | |
607 | 694 | }); |
608 | 695 | scope.notaPedido = { |
609 | 696 | vendedor: { NUM: false } |
... | ... | @@ -619,7 +706,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
619 | 706 | |
620 | 707 | it('función seleccionarCliente abre modal', function() { |
621 | 708 | //arrange |
622 | - var scope = {}; | |
709 | + var scope = { | |
710 | + $watch: function() { }, | |
711 | + $broadcast: function() { } | |
712 | + }; | |
623 | 713 | var uibModal = { |
624 | 714 | open: function() { } |
625 | 715 | }; |
... | ... | @@ -631,6 +721,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
631 | 721 | $filter: filter, |
632 | 722 | $timeout: timeout, |
633 | 723 | crearNotaPedidoService: { |
724 | + getNumeroNotaPedido: function() { | |
725 | + return { | |
726 | + then: function() { } | |
727 | + }; | |
728 | + }, | |
634 | 729 | getBotonera: function() { }, |
635 | 730 | getCotizacionByIdMoneda: function() { |
636 | 731 | return { |
... | ... | @@ -647,8 +742,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
647 | 742 | focaSeguimientoService: {}, |
648 | 743 | APP: {}, |
649 | 744 | focaLoginService: {}, |
650 | - $localStorage: {}, | |
651 | - $watch: function() { } | |
745 | + $localStorage: {} | |
652 | 746 | }); |
653 | 747 | scope.notaPedido = { |
654 | 748 | vendedor: { NUM: true } |
... | ... | @@ -667,7 +761,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
667 | 761 | it('función seleccionarCliente setea vendedor y llama a domicilios', function(done) { |
668 | 762 | |
669 | 763 | //arrange |
670 | - var scope = {}; | |
764 | + var scope = { | |
765 | + $watch: function() { }, | |
766 | + $broadcast: function() { } | |
767 | + }; | |
671 | 768 | var uibModal = { |
672 | 769 | open: function() { } |
673 | 770 | }; |
... | ... | @@ -679,6 +776,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
679 | 776 | $filter: filter, |
680 | 777 | $timeout: timeout, |
681 | 778 | crearNotaPedidoService: { |
779 | + getNumeroNotaPedido: function() { | |
780 | + return { | |
781 | + then: function() { } | |
782 | + }; | |
783 | + }, | |
682 | 784 | getBotonera: function() { }, |
683 | 785 | getCotizacionByIdMoneda: function() { |
684 | 786 | return { |
... | ... | @@ -695,8 +797,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
695 | 797 | focaSeguimientoService: {}, |
696 | 798 | APP: {}, |
697 | 799 | focaLoginService: {}, |
698 | - $localStorage: {}, | |
699 | - $watch: function() { } | |
800 | + $localStorage: {} | |
700 | 801 | }); |
701 | 802 | scope.idLista = true; |
702 | 803 | scope.notaPedido = { |
... | ... | @@ -720,7 +821,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
720 | 821 | |
721 | 822 | it('función abrirModalDomicilios abre modal', function() { |
722 | 823 | //arrange |
723 | - var scope = {}; | |
824 | + var scope = { | |
825 | + $watch: function() { }, | |
826 | + $broadcast: function() { } | |
827 | + }; | |
724 | 828 | var uibModal = { |
725 | 829 | open: function() { } |
726 | 830 | }; |
... | ... | @@ -732,6 +836,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
732 | 836 | $filter: filter, |
733 | 837 | $timeout: timeout, |
734 | 838 | crearNotaPedidoService: { |
839 | + getNumeroNotaPedido: function() { | |
840 | + return { | |
841 | + then: function() { } | |
842 | + }; | |
843 | + }, | |
735 | 844 | getBotonera: function() { }, |
736 | 845 | getCotizacionByIdMoneda: function() { |
737 | 846 | return { |
... | ... | @@ -748,8 +857,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
748 | 857 | focaSeguimientoService: {}, |
749 | 858 | APP: {}, |
750 | 859 | focaLoginService: {}, |
751 | - $localStorage: {}, | |
752 | - $watch: function() { } | |
860 | + $localStorage: {} | |
753 | 861 | }); |
754 | 862 | |
755 | 863 | var respuesta = { result: {then: function() { } } }; |
... | ... | @@ -765,7 +873,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
765 | 873 | it('función abrirModalDomicilios setea domicilio, cliente y cabeceras', function(done) { |
766 | 874 | |
767 | 875 | //arrange |
768 | - var scope = {}; | |
876 | + var scope = { | |
877 | + $watch: function() { }, | |
878 | + $broadcast: function() { } | |
879 | + }; | |
769 | 880 | var uibModal = { |
770 | 881 | open: function() { } |
771 | 882 | }; |
... | ... | @@ -777,6 +888,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
777 | 888 | $filter: filter, |
778 | 889 | $timeout: timeout, |
779 | 890 | crearNotaPedidoService: { |
891 | + getNumeroNotaPedido: function() { | |
892 | + return { | |
893 | + then: function() { } | |
894 | + }; | |
895 | + }, | |
780 | 896 | getBotonera: function() { }, |
781 | 897 | getCotizacionByIdMoneda: function() { |
782 | 898 | return { |
... | ... | @@ -798,8 +914,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
798 | 914 | focaSeguimientoService: {}, |
799 | 915 | APP: {}, |
800 | 916 | focaLoginService: {}, |
801 | - $localStorage: {}, | |
802 | - $watch: function() { } | |
917 | + $localStorage: {} | |
803 | 918 | }); |
804 | 919 | scope.idLista = true; |
805 | 920 | scope.notaPedido = { |
... | ... | @@ -831,7 +946,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
831 | 946 | it('función getTotal devulve correctamente', function() { |
832 | 947 | |
833 | 948 | //arrange |
834 | - var scope = {}; | |
949 | + var scope = { | |
950 | + $watch: function() { }, | |
951 | + $broadcast: function() { } | |
952 | + }; | |
835 | 953 | |
836 | 954 | $controler('notaPedidoCtrl', { |
837 | 955 | $scope: scope, |
... | ... | @@ -840,6 +958,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
840 | 958 | $filter: filter, |
841 | 959 | $timeout: timeout, |
842 | 960 | crearNotaPedidoService: { |
961 | + getNumeroNotaPedido: function() { | |
962 | + return { | |
963 | + then: function() { } | |
964 | + }; | |
965 | + }, | |
843 | 966 | getBotonera: function() { }, |
844 | 967 | getCotizacionByIdMoneda: function() { |
845 | 968 | return { |
... | ... | @@ -856,8 +979,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
856 | 979 | focaSeguimientoService: {}, |
857 | 980 | APP: {}, |
858 | 981 | focaLoginService: {}, |
859 | - $localStorage: {}, | |
860 | - $watch: function() { } | |
982 | + $localStorage: {} | |
861 | 983 | }); |
862 | 984 | scope.idLista = true; |
863 | 985 | scope.notaPedido = { |
... | ... | @@ -865,9 +987,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
865 | 987 | }; |
866 | 988 | |
867 | 989 | //act |
868 | - scope.articulosTabla = [{ precio: 2, cantidad: 1}]; | |
990 | + scope.notaPedido.articulosNotaPedido = [{ precio: 2, cantidad: 1}]; | |
869 | 991 | var esperado = 2; |
870 | 992 | var resultado = scope.getTotal(); |
993 | + console.log('resultado', resultado); | |
871 | 994 | |
872 | 995 | //assert |
873 | 996 | expect(resultado).toEqual(esperado); |
... | ... | @@ -876,7 +999,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
876 | 999 | it('función getSubTotal devulve correctamente', function() { |
877 | 1000 | |
878 | 1001 | //arrange |
879 | - var scope = {}; | |
1002 | + var scope = { | |
1003 | + $watch: function() { }, | |
1004 | + $broadcast: function() { } | |
1005 | + }; | |
880 | 1006 | |
881 | 1007 | $controler('notaPedidoCtrl', { |
882 | 1008 | $scope: scope, |
... | ... | @@ -885,6 +1011,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
885 | 1011 | $filter: filter, |
886 | 1012 | $timeout: timeout, |
887 | 1013 | crearNotaPedidoService: { |
1014 | + getNumeroNotaPedido: function() { | |
1015 | + return { | |
1016 | + then: function() { } | |
1017 | + }; | |
1018 | + }, | |
888 | 1019 | getBotonera: function() { }, |
889 | 1020 | getCotizacionByIdMoneda: function() { |
890 | 1021 | return { |
... | ... | @@ -901,8 +1032,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
901 | 1032 | focaSeguimientoService: {}, |
902 | 1033 | APP: {}, |
903 | 1034 | focaLoginService: {}, |
904 | - $localStorage: {}, | |
905 | - $watch: function() { } | |
1035 | + $localStorage: {} | |
906 | 1036 | }); |
907 | 1037 | scope.idLista = true; |
908 | 1038 | scope.notaPedido = { |
... | ... | @@ -921,7 +1051,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
921 | 1051 | it('función seleccionarPreciosYCondiciones abre modal', function() { |
922 | 1052 | |
923 | 1053 | //arrange |
924 | - var scope = {}; | |
1054 | + var scope = { | |
1055 | + $watch: function() { }, | |
1056 | + $broadcast: function() { } | |
1057 | + }; | |
925 | 1058 | var uibModal = { |
926 | 1059 | open: function() { } |
927 | 1060 | }; |
... | ... | @@ -933,6 +1066,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
933 | 1066 | $filter: filter, |
934 | 1067 | $timeout: timeout, |
935 | 1068 | crearNotaPedidoService: { |
1069 | + getNumeroNotaPedido: function() { | |
1070 | + return { | |
1071 | + then: function() { } | |
1072 | + }; | |
1073 | + }, | |
936 | 1074 | getBotonera: function() { }, |
937 | 1075 | getCotizacionByIdMoneda: function() { |
938 | 1076 | return { |
... | ... | @@ -949,8 +1087,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
949 | 1087 | focaSeguimientoService: {}, |
950 | 1088 | APP: {}, |
951 | 1089 | focaLoginService: {}, |
952 | - $localStorage: {}, | |
953 | - $watch: function() { } | |
1090 | + $localStorage: {} | |
954 | 1091 | }); |
955 | 1092 | |
956 | 1093 | scope.notaPedido = {}; |
... | ... | @@ -968,7 +1105,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
968 | 1105 | it('función seleccionarPreciosYCondiciones setea articulos y cabecera', function(done) { |
969 | 1106 | |
970 | 1107 | //arrange |
971 | - var scope = {}; | |
1108 | + var scope = { | |
1109 | + $watch: function() { }, | |
1110 | + $broadcast: function() { } | |
1111 | + }; | |
972 | 1112 | var uibModal = { |
973 | 1113 | open: function() { } |
974 | 1114 | }; |
... | ... | @@ -980,6 +1120,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
980 | 1120 | $filter: filter, |
981 | 1121 | $timeout: timeout, |
982 | 1122 | crearNotaPedidoService: { |
1123 | + getNumeroNotaPedido: function() { | |
1124 | + return { | |
1125 | + then: function() { } | |
1126 | + }; | |
1127 | + }, | |
983 | 1128 | getBotonera: function() { }, |
984 | 1129 | getCotizacionByIdMoneda: function() { |
985 | 1130 | return { |
... | ... | @@ -996,8 +1141,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
996 | 1141 | focaSeguimientoService: {}, |
997 | 1142 | APP: {}, |
998 | 1143 | focaLoginService: {}, |
999 | - $localStorage: {}, | |
1000 | - $watch: function() { } | |
1144 | + $localStorage: {} | |
1001 | 1145 | }); |
1002 | 1146 | scope.idLista = true; |
1003 | 1147 | scope.notaPedido = { |
... | ... | @@ -1014,7 +1158,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1014 | 1158 | |
1015 | 1159 | //assert |
1016 | 1160 | promesaRespuesta.result.then(function() { |
1017 | - expect(scope.articulosTabla.length).toEqual(0); | |
1161 | + expect(scope.notaPedido.articulosNotaPedido.length).toEqual(0); | |
1018 | 1162 | expect(scope.$broadcast).toHaveBeenCalled(); |
1019 | 1163 | done(); |
1020 | 1164 | }); |
... | ... | @@ -1023,7 +1167,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1023 | 1167 | it('función seleccionarFlete abre modal', function() { |
1024 | 1168 | |
1025 | 1169 | //arrange |
1026 | - var scope = {}; | |
1170 | + var scope = { | |
1171 | + $watch: function() { }, | |
1172 | + $broadcast: function() { } | |
1173 | + }; | |
1027 | 1174 | var uibModal = { |
1028 | 1175 | open: function() { } |
1029 | 1176 | }; |
... | ... | @@ -1035,6 +1182,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1035 | 1182 | $filter: filter, |
1036 | 1183 | $timeout: timeout, |
1037 | 1184 | crearNotaPedidoService: { |
1185 | + getNumeroNotaPedido: function() { | |
1186 | + return { | |
1187 | + then: function() { } | |
1188 | + }; | |
1189 | + }, | |
1038 | 1190 | getBotonera: function() { }, |
1039 | 1191 | getCotizacionByIdMoneda: function() { |
1040 | 1192 | return { |
... | ... | @@ -1051,8 +1203,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1051 | 1203 | focaSeguimientoService: {}, |
1052 | 1204 | APP: {}, |
1053 | 1205 | focaLoginService: {}, |
1054 | - $localStorage: {}, | |
1055 | - $watch: function() { } | |
1206 | + $localStorage: {} | |
1056 | 1207 | }); |
1057 | 1208 | |
1058 | 1209 | scope.notaPedido = {}; |
... | ... | @@ -1070,7 +1221,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1070 | 1221 | it('función seleccionarFlete setea flete y cabecera', function(done) { |
1071 | 1222 | |
1072 | 1223 | //arrange |
1073 | - var scope = {}; | |
1224 | + var scope = { | |
1225 | + $watch: function() { }, | |
1226 | + $broadcast: function() { } | |
1227 | + }; | |
1074 | 1228 | var uibModal = { |
1075 | 1229 | open: function() { } |
1076 | 1230 | }; |
... | ... | @@ -1082,6 +1236,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1082 | 1236 | $filter: filter, |
1083 | 1237 | $timeout: timeout, |
1084 | 1238 | crearNotaPedidoService: { |
1239 | + getNumeroNotaPedido: function() { | |
1240 | + return { | |
1241 | + then: function() { } | |
1242 | + }; | |
1243 | + }, | |
1085 | 1244 | getBotonera: function() { }, |
1086 | 1245 | getCotizacionByIdMoneda: function() { |
1087 | 1246 | return { |
... | ... | @@ -1098,8 +1257,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1098 | 1257 | focaSeguimientoService: {}, |
1099 | 1258 | APP: {}, |
1100 | 1259 | focaLoginService: {}, |
1101 | - $localStorage: {}, | |
1102 | - $watch: function() { } | |
1260 | + $localStorage: {} | |
1103 | 1261 | }); |
1104 | 1262 | scope.idLista = true; |
1105 | 1263 | scope.notaPedido = { |
... | ... | @@ -1128,7 +1286,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1128 | 1286 | |
1129 | 1287 | it('función seleccionarMoneda abre modal', function() { |
1130 | 1288 | //arrange |
1131 | - var scope = {}; | |
1289 | + var scope = { | |
1290 | + $watch: function() { }, | |
1291 | + $broadcast: function() { } | |
1292 | + }; | |
1132 | 1293 | var focaModalService = { |
1133 | 1294 | modal: function() { } |
1134 | 1295 | }; |
... | ... | @@ -1140,6 +1301,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1140 | 1301 | $filter: filter, |
1141 | 1302 | $timeout: timeout, |
1142 | 1303 | crearNotaPedidoService: { |
1304 | + getNumeroNotaPedido: function() { | |
1305 | + return { | |
1306 | + then: function() { } | |
1307 | + }; | |
1308 | + }, | |
1143 | 1309 | getBotonera: function() { }, |
1144 | 1310 | getCotizacionByIdMoneda: function() { |
1145 | 1311 | return { |
... | ... | @@ -1156,8 +1322,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1156 | 1322 | focaSeguimientoService: {}, |
1157 | 1323 | APP: {}, |
1158 | 1324 | focaLoginService: {}, |
1159 | - $localStorage: {}, | |
1160 | - $watch: function() { } | |
1325 | + $localStorage: {} | |
1161 | 1326 | }); |
1162 | 1327 | scope.notaPedido = {}; |
1163 | 1328 | |
... | ... | @@ -1173,7 +1338,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1173 | 1338 | |
1174 | 1339 | it('función seleccionarMoneda llama Modal Cotizacion', function(done) { |
1175 | 1340 | //arrange |
1176 | - var scope = {}; | |
1341 | + var scope = { | |
1342 | + $watch: function() { }, | |
1343 | + $broadcast: function() { } | |
1344 | + }; | |
1177 | 1345 | var focaModalService = { |
1178 | 1346 | modal: function() { } |
1179 | 1347 | }; |
... | ... | @@ -1185,6 +1353,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1185 | 1353 | $filter: filter, |
1186 | 1354 | $timeout: timeout, |
1187 | 1355 | crearNotaPedidoService: { |
1356 | + getNumeroNotaPedido: function() { | |
1357 | + return { | |
1358 | + then: function() { } | |
1359 | + }; | |
1360 | + }, | |
1188 | 1361 | getBotonera: function() { }, |
1189 | 1362 | getCotizacionByIdMoneda: function() { |
1190 | 1363 | return { |
... | ... | @@ -1201,8 +1374,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1201 | 1374 | focaSeguimientoService: {}, |
1202 | 1375 | APP: {}, |
1203 | 1376 | focaLoginService: {}, |
1204 | - $localStorage: {}, | |
1205 | - $watch: function() { } | |
1377 | + $localStorage: {} | |
1206 | 1378 | }); |
1207 | 1379 | |
1208 | 1380 | scope.notaPedido = {}; |
... | ... | @@ -1224,7 +1396,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1224 | 1396 | it('función seleccionarObservaciones llama a prompt', function() { |
1225 | 1397 | |
1226 | 1398 | //arrange |
1227 | - var scope = {}; | |
1399 | + var scope = { | |
1400 | + $watch: function() { }, | |
1401 | + $broadcast: function() { } | |
1402 | + }; | |
1228 | 1403 | var focaModalService = { |
1229 | 1404 | prompt: function() { } |
1230 | 1405 | }; |
... | ... | @@ -1236,6 +1411,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1236 | 1411 | $filter: filter, |
1237 | 1412 | $timeout: timeout, |
1238 | 1413 | crearNotaPedidoService: { |
1414 | + getNumeroNotaPedido: function() { | |
1415 | + return { | |
1416 | + then: function() { } | |
1417 | + }; | |
1418 | + }, | |
1239 | 1419 | getBotonera: function() { }, |
1240 | 1420 | getCotizacionByIdMoneda: function() { |
1241 | 1421 | return { |
... | ... | @@ -1252,8 +1432,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1252 | 1432 | focaSeguimientoService: {}, |
1253 | 1433 | APP: {}, |
1254 | 1434 | focaLoginService: {}, |
1255 | - $localStorage: {}, | |
1256 | - $watch: function() { } | |
1435 | + $localStorage: {} | |
1257 | 1436 | }); |
1258 | 1437 | var respuesta = { then: function() { } }; |
1259 | 1438 | scope.notaPedido = {}; |
... | ... | @@ -1269,7 +1448,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1269 | 1448 | it('función seleccionarObservaciones setea observaciones', function(done) { |
1270 | 1449 | |
1271 | 1450 | //arrange |
1272 | - var scope = {}; | |
1451 | + var scope = { | |
1452 | + $watch: function() { }, | |
1453 | + $broadcast: function() { } | |
1454 | + }; | |
1273 | 1455 | var focaModalService = { |
1274 | 1456 | prompt: function() { } |
1275 | 1457 | }; |
... | ... | @@ -1281,6 +1463,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1281 | 1463 | $filter: filter, |
1282 | 1464 | $timeout: timeout, |
1283 | 1465 | crearNotaPedidoService: { |
1466 | + getNumeroNotaPedido: function() { | |
1467 | + return { | |
1468 | + then: function() { } | |
1469 | + }; | |
1470 | + }, | |
1284 | 1471 | getBotonera: function() { }, |
1285 | 1472 | getCotizacionByIdMoneda: function() { |
1286 | 1473 | return { |
... | ... | @@ -1297,8 +1484,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1297 | 1484 | focaSeguimientoService: {}, |
1298 | 1485 | APP: {}, |
1299 | 1486 | focaLoginService: {}, |
1300 | - $localStorage: {}, | |
1301 | - $watch: function() { } | |
1487 | + $localStorage: {} | |
1302 | 1488 | }); |
1303 | 1489 | var respuesta = 'unit test'; |
1304 | 1490 | var promesa = Promise.resolve(respuesta); |
... | ... | @@ -1318,7 +1504,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1318 | 1504 | it('función abrirModalCotizacion abre modal', function() { |
1319 | 1505 | |
1320 | 1506 | //arrange |
1321 | - var scope = {}; | |
1507 | + var scope = { | |
1508 | + $watch: function() { }, | |
1509 | + $broadcast: function() { } | |
1510 | + }; | |
1322 | 1511 | var uibModal = { |
1323 | 1512 | open: function() { } |
1324 | 1513 | }; |
... | ... | @@ -1330,6 +1519,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1330 | 1519 | $filter: filter, |
1331 | 1520 | $timeout: timeout, |
1332 | 1521 | crearNotaPedidoService: { |
1522 | + getNumeroNotaPedido: function() { | |
1523 | + return { | |
1524 | + then: function() { } | |
1525 | + }; | |
1526 | + }, | |
1333 | 1527 | getBotonera: function() { }, |
1334 | 1528 | getCotizacionByIdMoneda: function() { |
1335 | 1529 | return { |
... | ... | @@ -1346,8 +1540,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1346 | 1540 | focaSeguimientoService: {}, |
1347 | 1541 | APP: {}, |
1348 | 1542 | focaLoginService: {}, |
1349 | - $localStorage: {}, | |
1350 | - $watch: function() { } | |
1543 | + $localStorage: {} | |
1351 | 1544 | }); |
1352 | 1545 | |
1353 | 1546 | scope.notaPedido = {}; |
... | ... | @@ -1364,7 +1557,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1364 | 1557 | |
1365 | 1558 | it('función abrirModalCotizacion setea datos y cabecera', function(done) { |
1366 | 1559 | //arrange |
1367 | - var scope = {}; | |
1560 | + var scope = { | |
1561 | + $watch: function() { }, | |
1562 | + $broadcast: function() { } | |
1563 | + }; | |
1368 | 1564 | var uibModal = { |
1369 | 1565 | open: function() { } |
1370 | 1566 | }; |
... | ... | @@ -1376,6 +1572,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1376 | 1572 | $filter: filter, |
1377 | 1573 | $timeout: timeout, |
1378 | 1574 | crearNotaPedidoService: { |
1575 | + getNumeroNotaPedido: function() { | |
1576 | + return { | |
1577 | + then: function() { } | |
1578 | + }; | |
1579 | + }, | |
1379 | 1580 | getBotonera: function() { }, |
1380 | 1581 | getCotizacionByIdMoneda: function() { |
1381 | 1582 | return { |
... | ... | @@ -1393,7 +1594,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1393 | 1594 | APP: {}, |
1394 | 1595 | focaLoginService: {}, |
1395 | 1596 | $localStorage: {}, |
1396 | - $watch: function() { } | |
1597 | + articulosNotaPedido: [] | |
1397 | 1598 | }); |
1398 | 1599 | |
1399 | 1600 | scope.notaPedido = {}; |
... | ... | @@ -1412,9 +1613,6 @@ describe('Controladores módulo crear nota de pedido', function() { |
1412 | 1613 | promesaRespuesta.result.then(function() { |
1413 | 1614 | |
1414 | 1615 | expect(scope.$broadcast).toHaveBeenCalled(); |
1415 | - expect(scope.notaPedido.moneda).toEqual(moneda); | |
1416 | - expect(scope.monedaDefecto).toEqual(moneda); | |
1417 | - expect(scope.cotizacionDefecto).toEqual(cotizacion); | |
1418 | 1616 | expect(scope.notaPedido.cotizacion).toEqual(cotizacion); |
1419 | 1617 | done(); |
1420 | 1618 | }); |
... | ... | @@ -1423,7 +1621,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1423 | 1621 | it('función agregarATabla muestra alerta cuando a cargar undefined', function() { |
1424 | 1622 | |
1425 | 1623 | //arrange |
1426 | - var scope = {}; | |
1624 | + var scope = { | |
1625 | + $watch: function() { }, | |
1626 | + $broadcast: function() { } | |
1627 | + }; | |
1427 | 1628 | var focaModalService = { |
1428 | 1629 | alert: function() { } |
1429 | 1630 | }; |
... | ... | @@ -1435,6 +1636,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1435 | 1636 | $filter: filter, |
1436 | 1637 | $timeout: timeout, |
1437 | 1638 | crearNotaPedidoService: { |
1639 | + getNumeroNotaPedido: function() { | |
1640 | + return { | |
1641 | + then: function() { } | |
1642 | + }; | |
1643 | + }, | |
1438 | 1644 | getBotonera: function() { }, |
1439 | 1645 | getCotizacionByIdMoneda: function() { |
1440 | 1646 | return { |
... | ... | @@ -1451,8 +1657,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1451 | 1657 | focaSeguimientoService: {}, |
1452 | 1658 | APP: {}, |
1453 | 1659 | focaLoginService: {}, |
1454 | - $localStorage: {}, | |
1455 | - $watch: function() { } | |
1660 | + $localStorage: {} | |
1456 | 1661 | }); |
1457 | 1662 | scope.articuloACargar = {}; |
1458 | 1663 | |
... | ... | @@ -1467,7 +1672,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1467 | 1672 | it('función editarArticulo muestra alerta cuando a cargar es undefined', function() { |
1468 | 1673 | |
1469 | 1674 | //arrange |
1470 | - var scope = {}; | |
1675 | + var scope = { | |
1676 | + $watch: function() { }, | |
1677 | + $broadcast: function() { } | |
1678 | + }; | |
1471 | 1679 | var focaModalService = { |
1472 | 1680 | alert: function() { } |
1473 | 1681 | }; |
... | ... | @@ -1479,6 +1687,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1479 | 1687 | $filter: filter, |
1480 | 1688 | $timeout: timeout, |
1481 | 1689 | crearNotaPedidoService: { |
1690 | + getNumeroNotaPedido: function() { | |
1691 | + return { | |
1692 | + then: function() { } | |
1693 | + }; | |
1694 | + }, | |
1482 | 1695 | getBotonera: function() { }, |
1483 | 1696 | getCotizacionByIdMoneda: function() { |
1484 | 1697 | return { |
... | ... | @@ -1495,8 +1708,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
1495 | 1708 | focaSeguimientoService: {}, |
1496 | 1709 | APP: {}, |
1497 | 1710 | focaLoginService: {}, |
1498 | - $localStorage: {}, | |
1499 | - $watch: function() { } | |
1711 | + $localStorage: {} | |
1500 | 1712 | }); |
1501 | 1713 | scope.articuloACargar = {}; |
1502 | 1714 | |
... | ... | @@ -1513,7 +1725,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
1513 | 1725 | inject(function($location) { |
1514 | 1726 | |
1515 | 1727 | //arrange |
1516 | - var scope = {}; | |
1728 | + var scope = { | |
1729 | + $watch: function() { }, | |
1730 | + $broadcast: function() { } | |
1731 | + }; | |
1517 | 1732 | |
1518 | 1733 | $controler('notaPedidoCtrl', { |
1519 | 1734 | $scope: scope, |
... | ... | @@ -1522,6 +1737,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
1522 | 1737 | $filter: filter, |
1523 | 1738 | $timeout: timeout, |
1524 | 1739 | crearNotaPedidoService: { |
1740 | + getNumeroNotaPedido: function() { | |
1741 | + return { | |
1742 | + then: function() { } | |
1743 | + }; | |
1744 | + }, | |
1525 | 1745 | getBotonera: function() { }, |
1526 | 1746 | getCotizacionByIdMoneda: function() { |
1527 | 1747 | return { |
... | ... | @@ -1539,7 +1759,6 @@ describe('Controladores módulo crear nota de pedido', function() { |
1539 | 1759 | APP: {}, |
1540 | 1760 | focaLoginService: {}, |
1541 | 1761 | $localStorage: {}, |
1542 | - $watch: function() { } | |
1543 | 1762 | }); |
1544 | 1763 | |
1545 | 1764 | //act |
spec/controllerSpecCrearPedido.js
... | ... | @@ -27,12 +27,20 @@ describe('Controladores módulo crear nota de pedido', function() { |
27 | 27 | |
28 | 28 | //act |
29 | 29 | var controlador = $controler('notaPedidoCtrl', { |
30 | - $scope: {}, | |
30 | + $scope: { | |
31 | + $watch: function() { }, | |
32 | + $broadcast: function() {} | |
33 | + }, | |
31 | 34 | $uibModal: {}, |
32 | 35 | $location: {}, |
33 | 36 | $filter: filter, |
34 | 37 | $timeout: timeout, |
35 | 38 | crearNotaPedidoService: { |
39 | + getNumeroNotaPedido: function() { | |
40 | + return { | |
41 | + then: function() { } | |
42 | + }; | |
43 | + }, | |
36 | 44 | getBotonera: function() { }, |
37 | 45 | getCotizacionByIdMoneda: function() { |
38 | 46 | return { |
... | ... | @@ -49,8 +57,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
49 | 57 | focaSeguimientoService: {}, |
50 | 58 | APP: {}, |
51 | 59 | focaLoginService: {}, |
52 | - $localStorage: {}, | |
53 | - $watch: function() { } | |
60 | + $localStorage: {} | |
54 | 61 | }); |
55 | 62 | |
56 | 63 | //expect |
... | ... | @@ -60,7 +67,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
60 | 67 | it('la funcion $scope.crearNotaPedido muestra alerta cuando vendedor es null', function() { |
61 | 68 | |
62 | 69 | //arrange |
63 | - var scope = {}; | |
70 | + var scope = { | |
71 | + $watch: function() { }, | |
72 | + $broadcast: function() {} | |
73 | + }; | |
64 | 74 | var focaModalService = { |
65 | 75 | alert: function() { } |
66 | 76 | }; |
... | ... | @@ -72,6 +82,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
72 | 82 | $filter: filter, |
73 | 83 | $timeout: timeout, |
74 | 84 | crearNotaPedidoService: { |
85 | + getNumeroNotaPedido: function() { | |
86 | + return { | |
87 | + then: function() { } | |
88 | + }; | |
89 | + }, | |
75 | 90 | getBotonera: function() { }, |
76 | 91 | getCotizacionByIdMoneda: function() { |
77 | 92 | return { |
... | ... | @@ -89,7 +104,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
89 | 104 | APP: {}, |
90 | 105 | focaLoginService: {}, |
91 | 106 | $localStorage: {}, |
92 | - $watch: function() { } | |
107 | + $watch: function() { }, | |
108 | + $broadcast: function() {} | |
93 | 109 | }); |
94 | 110 | |
95 | 111 | //act |
... | ... | @@ -108,7 +124,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
108 | 124 | it('la funcion $scope.crearNotaPedido muestra alerta cuando cliente es null', function() { |
109 | 125 | |
110 | 126 | //arrange |
111 | - var scope = {}; | |
127 | + var scope = { | |
128 | + $watch: function() { }, | |
129 | + $broadcast: function() {} | |
130 | + }; | |
112 | 131 | var focaModalService = { |
113 | 132 | alert: function() { } |
114 | 133 | }; |
... | ... | @@ -120,6 +139,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
120 | 139 | $filter: filter, |
121 | 140 | $timeout: timeout, |
122 | 141 | crearNotaPedidoService: { |
142 | + getNumeroNotaPedido: function() { | |
143 | + return { | |
144 | + then: function() { } | |
145 | + }; | |
146 | + }, | |
123 | 147 | getBotonera: function() { }, |
124 | 148 | getCotizacionByIdMoneda: function() { |
125 | 149 | return { |
... | ... | @@ -137,7 +161,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
137 | 161 | APP: {}, |
138 | 162 | focaLoginService: {}, |
139 | 163 | $localStorage: {}, |
140 | - $watch: function() { } | |
164 | + $watch: function() { }, | |
165 | + $broadcast: function() {} | |
141 | 166 | }); |
142 | 167 | |
143 | 168 | scope.notaPedido = { |
... | ... | @@ -160,7 +185,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
160 | 185 | it('funcion $scope.crearNotaPedido muestra alerta cuando proveedor es null', function() { |
161 | 186 | |
162 | 187 | //arrange |
163 | - var scope = {}; | |
188 | + var scope = { | |
189 | + $watch: function() { }, | |
190 | + $broadcast: function() {} | |
191 | + }; | |
164 | 192 | var focaModalService = { |
165 | 193 | alert: function() { } |
166 | 194 | }; |
... | ... | @@ -172,6 +200,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
172 | 200 | $filter: filter, |
173 | 201 | $timeout: timeout, |
174 | 202 | crearNotaPedidoService: { |
203 | + getNumeroNotaPedido: function() { | |
204 | + return { | |
205 | + then: function() { } | |
206 | + }; | |
207 | + }, | |
175 | 208 | getBotonera: function() { }, |
176 | 209 | getCotizacionByIdMoneda: function() { |
177 | 210 | return { |
... | ... | @@ -189,7 +222,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
189 | 222 | APP: {}, |
190 | 223 | focaLoginService: {}, |
191 | 224 | $localStorage: {}, |
192 | - $watch: function() { } | |
225 | + $watch: function() { }, | |
226 | + $broadcast: function() {} | |
193 | 227 | }); |
194 | 228 | |
195 | 229 | scope.notaPedido = { |
... | ... | @@ -215,7 +249,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
215 | 249 | it('funcion $scope.crearNotaPedido muestra alerta cuando Moneda es null', function() { |
216 | 250 | |
217 | 251 | //arrange |
218 | - var scope = {}; | |
252 | + var scope = { | |
253 | + $watch: function() { }, | |
254 | + $broadcast: function() {} | |
255 | + }; | |
219 | 256 | var focaModalService = { |
220 | 257 | alert: function() { } |
221 | 258 | }; |
... | ... | @@ -227,6 +264,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
227 | 264 | $filter: filter, |
228 | 265 | $timeout: timeout, |
229 | 266 | crearNotaPedidoService: { |
267 | + getNumeroNotaPedido: function() { | |
268 | + return { | |
269 | + then: function() { } | |
270 | + }; | |
271 | + }, | |
230 | 272 | getBotonera: function() { }, |
231 | 273 | getCotizacionByIdMoneda: function() { |
232 | 274 | return { |
... | ... | @@ -244,7 +286,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
244 | 286 | APP: {}, |
245 | 287 | focaLoginService: {}, |
246 | 288 | $localStorage: {}, |
247 | - $watch: function() { } | |
289 | + $watch: function() { }, | |
290 | + $broadcast: function() {} | |
248 | 291 | }); |
249 | 292 | |
250 | 293 | scope.notaPedido = { |
... | ... | @@ -257,8 +300,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
257 | 300 | proveedor:{ |
258 | 301 | COD: true |
259 | 302 | }, |
260 | - moneda:{ | |
261 | - ID: null | |
303 | + cotizacion: { | |
304 | + ID: true, | |
305 | + moneda:{ | |
306 | + ID: null | |
307 | + } | |
262 | 308 | } |
263 | 309 | }; |
264 | 310 | |
... | ... | @@ -273,7 +319,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
273 | 319 | it('funcion $scope.crearNotaPedido muestra alerta cuando cotizacion es null', function() { |
274 | 320 | |
275 | 321 | //arrange |
276 | - var scope = {}; | |
322 | + var scope = { | |
323 | + $watch: function() { }, | |
324 | + $broadcast: function() {} | |
325 | + }; | |
277 | 326 | var focaModalService = { |
278 | 327 | alert: function() { } |
279 | 328 | }; |
... | ... | @@ -285,6 +334,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
285 | 334 | $filter: filter, |
286 | 335 | $timeout: timeout, |
287 | 336 | crearNotaPedidoService: { |
337 | + getNumeroNotaPedido: function() { | |
338 | + return { | |
339 | + then: function() { } | |
340 | + }; | |
341 | + }, | |
288 | 342 | getBotonera: function() { }, |
289 | 343 | getCotizacionByIdMoneda: function() { |
290 | 344 | return { |
... | ... | @@ -302,7 +356,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
302 | 356 | APP: {}, |
303 | 357 | focaLoginService: {}, |
304 | 358 | $localStorage: {}, |
305 | - $watch: function() { } | |
359 | + $watch: function() { }, | |
360 | + $broadcast: function() {} | |
306 | 361 | }); |
307 | 362 | |
308 | 363 | scope.notaPedido = { |
... | ... | @@ -315,11 +370,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
315 | 370 | proveedor:{ |
316 | 371 | COD: true |
317 | 372 | }, |
318 | - moneda:{ | |
319 | - ID: true | |
320 | - }, | |
321 | 373 | cotizacion:{ |
322 | - ID: null | |
374 | + ID: null, | |
375 | + moneda: { | |
376 | + ID: true | |
377 | + } | |
323 | 378 | } |
324 | 379 | }; |
325 | 380 | |
... | ... | @@ -334,7 +389,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
334 | 389 | it('funcion $scope.crearNotaPedido muestra alerta cuando plazos es null', function() { |
335 | 390 | |
336 | 391 | //arrange |
337 | - var scope = {}; | |
392 | + var scope = { | |
393 | + $watch: function() { }, | |
394 | + $broadcast: function() {} | |
395 | + }; | |
338 | 396 | var focaModalService = { |
339 | 397 | alert: function() { } |
340 | 398 | }; |
... | ... | @@ -346,6 +404,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
346 | 404 | $filter: filter, |
347 | 405 | $timeout: timeout, |
348 | 406 | crearNotaPedidoService: { |
407 | + getNumeroNotaPedido: function() { | |
408 | + return { | |
409 | + then: function() { } | |
410 | + }; | |
411 | + }, | |
349 | 412 | getBotonera: function() { }, |
350 | 413 | getCotizacionByIdMoneda: function() { |
351 | 414 | return { |
... | ... | @@ -363,7 +426,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
363 | 426 | APP: {}, |
364 | 427 | focaLoginService: {}, |
365 | 428 | $localStorage: {}, |
366 | - $watch: function() { } | |
429 | + $watch: function() { }, | |
430 | + $broadcast: function() {} | |
367 | 431 | }); |
368 | 432 | |
369 | 433 | scope.notaPedido = { |
... | ... | @@ -376,11 +440,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
376 | 440 | proveedor:{ |
377 | 441 | COD: true |
378 | 442 | }, |
379 | - moneda:{ | |
380 | - ID: true | |
381 | - }, | |
382 | 443 | cotizacion:{ |
383 | - ID: true | |
444 | + ID: true, | |
445 | + moneda:{ | |
446 | + ID: true | |
447 | + } | |
384 | 448 | } |
385 | 449 | }; |
386 | 450 | |
... | ... | @@ -397,7 +461,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
397 | 461 | it('funcion $scope.crearNotaPedido muestra alerta cuando flete es null', function() { |
398 | 462 | |
399 | 463 | //arrange |
400 | - var scope = {}; | |
464 | + var scope = { | |
465 | + $watch: function() { }, | |
466 | + $broadcast: function() {} | |
467 | + }; | |
401 | 468 | var focaModalService = { |
402 | 469 | alert: function() { } |
403 | 470 | }; |
... | ... | @@ -409,6 +476,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
409 | 476 | $filter: filter, |
410 | 477 | $timeout: timeout, |
411 | 478 | crearNotaPedidoService: { |
479 | + getNumeroNotaPedido: function() { | |
480 | + return { | |
481 | + then: function() { } | |
482 | + }; | |
483 | + }, | |
412 | 484 | getBotonera: function() { }, |
413 | 485 | getCotizacionByIdMoneda: function() { |
414 | 486 | return { |
... | ... | @@ -426,7 +498,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
426 | 498 | APP: {}, |
427 | 499 | focaLoginService: {}, |
428 | 500 | $localStorage: {}, |
429 | - $watch: function() { } | |
501 | + $watch: function() { }, | |
502 | + $broadcast: function() {} | |
430 | 503 | }); |
431 | 504 | |
432 | 505 | scope.notaPedido = { |
... | ... | @@ -439,13 +512,14 @@ describe('Controladores módulo crear nota de pedido', function() { |
439 | 512 | proveedor:{ |
440 | 513 | COD: true |
441 | 514 | }, |
442 | - moneda:{ | |
443 | - ID: true | |
444 | - }, | |
445 | 515 | cotizacion:{ |
446 | - ID: true | |
516 | + ID: true, | |
517 | + moneda:{ | |
518 | + ID: true | |
519 | + } | |
447 | 520 | }, |
448 | - flete: null | |
521 | + flete: null, | |
522 | + notaPedidoPlazo: [] | |
449 | 523 | }; |
450 | 524 | |
451 | 525 | scope.plazosPagos = true; |
... | ... | @@ -461,7 +535,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
461 | 535 | it('funcion $scope.crearNotaPedido muestra alerta cuando domicilio es null', function() { |
462 | 536 | |
463 | 537 | //arrange |
464 | - var scope = {}; | |
538 | + var scope = { | |
539 | + $watch: function() { }, | |
540 | + $broadcast: function() {} | |
541 | + }; | |
465 | 542 | var focaModalService = { |
466 | 543 | alert: function() { } |
467 | 544 | }; |
... | ... | @@ -473,6 +550,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
473 | 550 | $filter: filter, |
474 | 551 | $timeout: timeout, |
475 | 552 | crearNotaPedidoService: { |
553 | + getNumeroNotaPedido: function() { | |
554 | + return { | |
555 | + then: function() { } | |
556 | + }; | |
557 | + }, | |
476 | 558 | getBotonera: function() { }, |
477 | 559 | getCotizacionByIdMoneda: function() { |
478 | 560 | return { |
... | ... | @@ -490,7 +572,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
490 | 572 | APP: {}, |
491 | 573 | focaLoginService: {}, |
492 | 574 | $localStorage: {}, |
493 | - $watch: function() { } | |
575 | + $watch: function() { }, | |
576 | + $broadcast: function() {} | |
494 | 577 | }); |
495 | 578 | |
496 | 579 | scope.notaPedido = { |
... | ... | @@ -503,14 +586,15 @@ describe('Controladores módulo crear nota de pedido', function() { |
503 | 586 | proveedor:{ |
504 | 587 | COD: true |
505 | 588 | }, |
506 | - moneda:{ | |
507 | - ID: true | |
508 | - }, | |
509 | 589 | cotizacion:{ |
510 | - ID: true | |
590 | + ID: true, | |
591 | + moneda:{ | |
592 | + ID: true | |
593 | + } | |
511 | 594 | }, |
512 | 595 | flete: true, |
513 | - domicilioStamp: null | |
596 | + domicilioStamp: null, | |
597 | + notaPedidoPlazo: [] | |
514 | 598 | }; |
515 | 599 | |
516 | 600 | scope.plazosPagos = true; |
... | ... | @@ -528,7 +612,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
528 | 612 | { |
529 | 613 | |
530 | 614 | //arrange |
531 | - var scope = {}; | |
615 | + var scope = { | |
616 | + $watch: function() { }, | |
617 | + $broadcast: function() {} | |
618 | + }; | |
532 | 619 | var focaModalService = { |
533 | 620 | alert: function() { } |
534 | 621 | }; |
... | ... | @@ -540,14 +627,26 @@ describe('Controladores módulo crear nota de pedido', function() { |
540 | 627 | $filter: filter, |
541 | 628 | $timeout: timeout, |
542 | 629 | crearNotaPedidoService: { |
630 | + getNumeroNotaPedido: function() { | |
631 | + return { | |
632 | + then: function() {} | |
633 | + }; | |
634 | + }, | |
543 | 635 | getBotonera: function() { }, |
544 | 636 | getCotizacionByIdMoneda: function() { |
545 | 637 | return { |
546 | 638 | then: function() {} |
547 | 639 | }; |
640 | + }, | |
641 | + crearNotaPedido: function() { | |
642 | + return { | |
643 | + then: function() { } | |
644 | + }; | |
548 | 645 | } |
549 | 646 | }, |
550 | - focaBotoneraLateralService: {}, | |
647 | + focaBotoneraLateralService: { | |
648 | + startGuardar: function() {} | |
649 | + }, | |
551 | 650 | focaModalService: focaModalService, |
552 | 651 | notaPedidoBusinessService: {}, |
553 | 652 | $rootScope: { |
... | ... | @@ -557,7 +656,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
557 | 656 | APP: {}, |
558 | 657 | focaLoginService: {}, |
559 | 658 | $localStorage: {}, |
560 | - $watch: function() { } | |
659 | + $watch: function() { }, | |
660 | + $broadcast: function() {} | |
561 | 661 | }); |
562 | 662 | |
563 | 663 | scope.notaPedido = { |
... | ... | @@ -570,17 +670,25 @@ describe('Controladores módulo crear nota de pedido', function() { |
570 | 670 | proveedor:{ |
571 | 671 | COD: true |
572 | 672 | }, |
573 | - moneda:{ | |
574 | - ID: true | |
575 | - }, | |
576 | 673 | cotizacion:{ |
577 | - ID: true | |
674 | + ID: true, | |
675 | + moneda:{ | |
676 | + ID: true | |
677 | + } | |
678 | + }, | |
679 | + precioCondicion: { | |
680 | + id: true | |
681 | + }, | |
682 | + domicilio: { | |
683 | + id: true | |
578 | 684 | }, |
579 | 685 | flete: true, |
580 | 686 | domicilioStamp: true, |
687 | + notaPedidoPlazo: [], | |
688 | + articulosNotaPedido: [], | |
689 | + fechaCarga: true | |
581 | 690 | }; |
582 | 691 | |
583 | - scope.plazosPagos = true; | |
584 | 692 | scope.articulosTabla = []; |
585 | 693 | |
586 | 694 | //act |
... | ... | @@ -595,7 +703,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
595 | 703 | it('funcion $scope.crearNotaPedido llama startGuardar', function() { |
596 | 704 | |
597 | 705 | //arrange |
598 | - var scope = {}; | |
706 | + var scope = { | |
707 | + $watch: function() { }, | |
708 | + $broadcast: function() {} | |
709 | + }; | |
599 | 710 | var focaBotoneraLateralService = { |
600 | 711 | startGuardar: function() { } |
601 | 712 | }; |
... | ... | @@ -607,6 +718,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
607 | 718 | $filter: filter, |
608 | 719 | $timeout: timeout, |
609 | 720 | crearNotaPedidoService: { |
721 | + getNumeroNotaPedido: function() { | |
722 | + return { | |
723 | + then: function() { } | |
724 | + }; | |
725 | + }, | |
610 | 726 | getBotonera: function() { }, |
611 | 727 | getCotizacionByIdMoneda: function() { |
612 | 728 | return { |
... | ... | @@ -620,7 +736,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
620 | 736 | } |
621 | 737 | }, |
622 | 738 | focaBotoneraLateralService: focaBotoneraLateralService, |
623 | - focaModalService: {}, | |
739 | + focaModalService: { | |
740 | + alert: function() {} | |
741 | + }, | |
624 | 742 | notaPedidoBusinessService: {}, |
625 | 743 | $rootScope: { |
626 | 744 | $on: function() { } |
... | ... | @@ -629,7 +747,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
629 | 747 | APP: {}, |
630 | 748 | focaLoginService: {}, |
631 | 749 | $localStorage: {}, |
632 | - $watch: function() { } | |
750 | + $watch: function() { }, | |
751 | + $broadcast: function() {} | |
633 | 752 | }); |
634 | 753 | |
635 | 754 | scope.notaPedido = { |
... | ... | @@ -642,17 +761,20 @@ describe('Controladores módulo crear nota de pedido', function() { |
642 | 761 | proveedor:{ |
643 | 762 | COD: true |
644 | 763 | }, |
645 | - moneda:{ | |
646 | - ID: true | |
647 | - }, | |
648 | 764 | cotizacion:{ |
649 | - ID: true | |
765 | + ID: true, | |
766 | + moneda:{ | |
767 | + ID: true | |
768 | + } | |
650 | 769 | }, |
651 | 770 | flete: true, |
652 | 771 | domicilioStamp: true, |
653 | 772 | domicilio: { |
654 | 773 | id: true |
655 | - } | |
774 | + }, | |
775 | + notaPedidoPlazo: [], | |
776 | + articulosNotaPedido: true, | |
777 | + fechaCarga: true | |
656 | 778 | }; |
657 | 779 | |
658 | 780 | scope.plazosPagos = true; |
... | ... | @@ -660,7 +782,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
660 | 782 | |
661 | 783 | //act |
662 | 784 | spyOn(focaBotoneraLateralService, 'startGuardar'); |
663 | - scope.crearNotaPedido(); | |
785 | + scope.crearNotaPedido(scope.notaPedido); | |
664 | 786 | |
665 | 787 | //expect |
666 | 788 | expect(focaBotoneraLateralService.startGuardar).toHaveBeenCalled(); |
... | ... | @@ -669,7 +791,10 @@ describe('Controladores módulo crear nota de pedido', function() { |
669 | 791 | it('funcion $scope.crearNotaPedido llama funciones al guardar', function(done) { |
670 | 792 | |
671 | 793 | //arrange |
672 | - var scope = {}; | |
794 | + var scope = { | |
795 | + $watch: function() { }, | |
796 | + $broadcast: function() {} | |
797 | + }; | |
673 | 798 | var focaBotoneraLateralService = { |
674 | 799 | startGuardar: function() { }, |
675 | 800 | endGuardar: function() { } |
... | ... | @@ -688,7 +813,11 @@ describe('Controladores módulo crear nota de pedido', function() { |
688 | 813 | then: function() {} |
689 | 814 | }; |
690 | 815 | }, |
691 | - crearNotaPedido: function() { }, | |
816 | + crearNotaPedido: function() { | |
817 | + return { | |
818 | + then: function() { } | |
819 | + }; | |
820 | + }, | |
692 | 821 | getNumeroNotaPedido: function() { |
693 | 822 | return { |
694 | 823 | then: function() { } |
... | ... | @@ -704,7 +833,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
704 | 833 | $timeout: timeout, |
705 | 834 | crearNotaPedidoService: crearNotaPedidoService, |
706 | 835 | focaBotoneraLateralService: focaBotoneraLateralService, |
707 | - focaModalService: {}, | |
836 | + focaModalService: { | |
837 | + alert: function() {} | |
838 | + }, | |
708 | 839 | notaPedidoBusinessService: notaPedidoBusinessService, |
709 | 840 | $rootScope: { |
710 | 841 | $on: function() { } |
... | ... | @@ -713,7 +844,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
713 | 844 | APP: {}, |
714 | 845 | focaLoginService: {}, |
715 | 846 | $localStorage: {}, |
716 | - $watch: function() { } | |
847 | + $watch: function() { }, | |
848 | + $broadcast: function() {} | |
717 | 849 | }); |
718 | 850 | |
719 | 851 | scope.notaPedido = { |
... | ... | @@ -726,17 +858,20 @@ describe('Controladores módulo crear nota de pedido', function() { |
726 | 858 | proveedor:{ |
727 | 859 | COD: true |
728 | 860 | }, |
729 | - moneda:{ | |
730 | - ID: true | |
731 | - }, | |
732 | 861 | cotizacion:{ |
733 | - ID: true | |
862 | + ID: true, | |
863 | + moneda:{ | |
864 | + ID: true | |
865 | + } | |
734 | 866 | }, |
735 | 867 | flete: true, |
736 | 868 | domicilioStamp: true, |
737 | 869 | domicilio: { |
738 | 870 | id: true |
739 | - } | |
871 | + }, | |
872 | + notaPedidoPlazo: [], | |
873 | + articulosNotaPedido: [1], | |
874 | + fechaCarga: true | |
740 | 875 | }; |
741 | 876 | |
742 | 877 | scope.plazosPagos = []; |
... | ... | @@ -750,13 +885,13 @@ describe('Controladores módulo crear nota de pedido', function() { |
750 | 885 | spyOn(focaSeguimientoService, 'guardarPosicion'); |
751 | 886 | spyOn(notaPedidoBusinessService, 'addArticulos'); |
752 | 887 | scope.crearNotaPedido(); |
753 | - | |
754 | 888 | //expect |
755 | - promesa.then(function() { | |
889 | + crearNotaPedidoService.crearNotaPedido().then(function() { | |
756 | 890 | expect(focaSeguimientoService.guardarPosicion).toHaveBeenCalled(); |
757 | 891 | expect(notaPedidoBusinessService.addArticulos).toHaveBeenCalled(); |
758 | 892 | done(); |
759 | - }); | |
893 | + }).catch(done); | |
894 | + | |
760 | 895 | }); |
761 | 896 | }); |
762 | 897 | }); |
src/js/controller.js
... | ... | @@ -55,15 +55,17 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
55 | 55 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
56 | 56 | var monedaPorDefecto = res.data[0]; |
57 | 57 | |
58 | - $scope.cotizacionPorDefecto = Object.assign( | |
58 | + $scope.notaPedido.cotizacion = Object.assign( | |
59 | 59 | {moneda: monedaPorDefecto}, |
60 | 60 | monedaPorDefecto.cotizaciones[0] |
61 | 61 | ); |
62 | 62 | |
63 | - init(); | |
64 | - getLSNotaPedido(); | |
63 | + $scope.inicial.cotizacion = $scope.notaPedido.cotizacion; | |
64 | + | |
65 | 65 | }); |
66 | - | |
66 | + | |
67 | + init(); | |
68 | + $timeout(function() {getLSNotaPedido();}); | |
67 | 69 | |
68 | 70 | } |
69 | 71 | |
... | ... | @@ -77,8 +79,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
77 | 79 | domicilio: {dom: ''}, |
78 | 80 | vendedor: {}, |
79 | 81 | fechaCarga: new Date(), |
80 | - cotizacion: $scope.cotizacionPorDefecto, | |
81 | - articulosNotaPedido: [] | |
82 | + cotizacion: {}, | |
83 | + articulosNotaPedido: [], | |
84 | + notaPedidoPlazo: [] | |
82 | 85 | }; |
83 | 86 | |
84 | 87 | $scope.idLista = undefined; |
... | ... | @@ -135,12 +138,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
135 | 138 | } else if(!$scope.notaPedido.proveedor.COD) { |
136 | 139 | focaModalService.alert('Ingrese Proveedor'); |
137 | 140 | return; |
138 | - } else if(!$scope.notaPedido.cotizacion.moneda.ID) { | |
139 | - focaModalService.alert('Ingrese Moneda'); | |
140 | - return; | |
141 | 141 | } else if(!$scope.notaPedido.cotizacion.ID) { |
142 | 142 | focaModalService.alert('Ingrese Cotización'); |
143 | 143 | return; |
144 | + } else if(!$scope.notaPedido.cotizacion.moneda.ID) { | |
145 | + focaModalService.alert('Ingrese Moneda'); | |
146 | + return; | |
144 | 147 | } else if(!$scope.notaPedido.notaPedidoPlazo) { |
145 | 148 | focaModalService.alert('Ingrese Precios y Condiciones'); |
146 | 149 | return; |
... | ... | @@ -674,7 +677,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
674 | 677 | ); |
675 | 678 | modalInstance.result.then( |
676 | 679 | function(cotizacion) { |
677 | - var articulosTablaTemp = $scope.notaPedido.articulosNotaPedido; | |
680 | + var articulosTablaTemp = $scope.notaPedido.articulosNotaPedido || []; | |
678 | 681 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
679 | 682 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
680 | 683 | $scope.notaPedido.cotizacion.VENDEDOR; |
... | ... | @@ -824,7 +827,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
824 | 827 | ' - ' + notaPedido.proveedor.NOM |
825 | 828 | }); |
826 | 829 | } |
827 | - if (notaPedido.notaPedidoPlazo) { | |
830 | + if (notaPedido.notaPedidoPlazo.length) { | |
828 | 831 | cabeceras.push({ |
829 | 832 | label: 'Precios y condiciones:', |
830 | 833 | valor: valorPrecioCondicion() + ' ' + |