Commit 84629b956ed9c9ff33bb3776e9fd4e6dc3efff9a
1 parent
28a0de6a8c
Exists in
master
Solucion de error en Test
Showing
2 changed files
with
14 additions
and
7 deletions
Show diff stats
spec/controllerSpec.js
| ... | ... | @@ -910,16 +910,18 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 910 | 910 | var cliente = { |
| 911 | 911 | COD: undefined, |
| 912 | 912 | CUIT: undefined, |
| 913 | - NOM: undefined | |
| 913 | + NOM: undefined, | |
| 914 | + MOD: undefined | |
| 914 | 915 | }; |
| 915 | 916 | |
| 916 | 917 | //act |
| 917 | 918 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); |
| 918 | 919 | spyOn(scope, '$broadcast'); |
| 919 | - scope.abrirModalDomicilios({ }); | |
| 920 | + scope.abrirModalDomicilios(cliente); | |
| 920 | 921 | |
| 921 | 922 | //assert |
| 922 | 923 | promesaRespuesta.result.then(function() { |
| 924 | + //scope.notaPedido.domicilio sea vacio | |
| 923 | 925 | expect(scope.notaPedido.domicilio).toEqual(respuesta); |
| 924 | 926 | expect(scope.notaPedido.cliente).toEqual(cliente); |
| 925 | 927 | expect(scope.$broadcast).toHaveBeenCalled(); |
| ... | ... | @@ -1037,6 +1039,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 1037 | 1039 | var scope = { |
| 1038 | 1040 | $watch: function() { }, |
| 1039 | 1041 | $broadcast: function() { } |
| 1042 | + | |
| 1043 | + | |
| 1040 | 1044 | }; |
| 1041 | 1045 | var uibModal = { |
| 1042 | 1046 | open: function() { } |
| ... | ... | @@ -1073,7 +1077,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 1073 | 1077 | $localStorage: {} |
| 1074 | 1078 | }); |
| 1075 | 1079 | |
| 1076 | - scope.notaPedido = {}; | |
| 1080 | + scope.notaPedido = { | |
| 1081 | + cliente: { COD: true } | |
| 1082 | + }; | |
| 1077 | 1083 | |
| 1078 | 1084 | var respuesta = { result: {then: function() { } } }; |
| 1079 | 1085 | |
| ... | ... | @@ -1128,7 +1134,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 1128 | 1134 | }); |
| 1129 | 1135 | scope.idLista = true; |
| 1130 | 1136 | scope.notaPedido = { |
| 1131 | - vendedor: { NUM: true } | |
| 1137 | + vendedor: { NUM: true }, | |
| 1138 | + cliente: { COD: true } | |
| 1132 | 1139 | }; |
| 1133 | 1140 | var respuesta = { plazoPago: { } }; |
| 1134 | 1141 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; |
src/js/controller.js
| ... | ... | @@ -48,7 +48,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 48 | 48 | if (APP === 'distribuidor') { |
| 49 | 49 | $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador; |
| 50 | 50 | } |
| 51 | - | |
| 51 | + | |
| 52 | 52 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
| 53 | 53 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
| 54 | 54 | var monedaPorDefecto = res.data[0]; |
| ... | ... | @@ -816,7 +816,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 816 | 816 | }); |
| 817 | 817 | cabeceras.push({ |
| 818 | 818 | label: 'Fecha cotizacion:', |
| 819 | - valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
| 819 | + valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
| 820 | 820 | 'dd/MM/yyyy') |
| 821 | 821 | }); |
| 822 | 822 | cabeceras.push({ |
| ... | ... | @@ -892,7 +892,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 892 | 892 | } |
| 893 | 893 | cabeceras.push(cabeceraBomba); |
| 894 | 894 | } |
| 895 | - | |
| 895 | + | |
| 896 | 896 | notaPedidoBusinessService.calcularArticulos($scope.notaPedido.articulosNotaPedido, |
| 897 | 897 | notaPedido.cotizacion.VENDEDOR); |
| 898 | 898 |