From e5e532b1f8eaf3288eba61d3d0cd990718696cf7 Mon Sep 17 00:00:00 2001 From: Luigi Date: Thu, 14 Mar 2019 17:00:56 -0300 Subject: [PATCH] Arreglo de errores Test --- spec/controllerSpec.js | 60 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/spec/controllerSpec.js b/spec/controllerSpec.js index ed0a311..d8db0d6 100644 --- a/spec/controllerSpec.js +++ b/spec/controllerSpec.js @@ -25,6 +25,7 @@ describe('Controladores abm precios condiciones', function() { focaAbmPreciosCondicionesService: {}, $location: {}, focaModalService: {}, + $localStorage: {}, focaBotoneraLateralService: {}, $timeout: timeout }); @@ -42,6 +43,7 @@ describe('Controladores abm precios condiciones', function() { $scope: scope, focaAbmPreciosCondicionesService: {}, $location: $location, + $localStorage: {}, focaModalService: {}, focaBotoneraLateralService: {}, $timeout: timeout @@ -67,6 +69,7 @@ describe('Controladores abm precios condiciones', function() { $scope: scope, focaAbmPreciosCondicionesService: {}, $location: {}, + $localStorage: {}, focaModalService: focaModalService, focaBotoneraLateralService: {}, $timeout: timeout @@ -94,6 +97,7 @@ describe('Controladores abm precios condiciones', function() { $scope: scope, focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, $location: {}, + $localStorage: {}, focaModalService: focaModalService, focaBotoneraLateralService: {}, $timeout: timeout @@ -123,6 +127,7 @@ describe('Controladores abm precios condiciones', function() { $scope: scope, focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, $location: {}, + $localStorage: {}, focaModalService: {}, focaBotoneraLateralService: {}, $timeout: timeout @@ -143,7 +148,9 @@ describe('Controladores abm precios condiciones', function() { it('Existe el controlador focaAbmPrecioCondicionController', function() { //act var controlador = $controller('focaAbmPrecioCondicionController', { - $scope: {}, + $scope: { + $watch: function(){} + }, focaAbmPreciosCondicionesService: { obtenerPrecioCondicion: function() { return { @@ -157,6 +164,7 @@ describe('Controladores abm precios condiciones', function() { focaModalService: {}, $timeout: timeout, $uibModal: {}, + $localStorage: {}, $window: {} }); @@ -167,7 +175,11 @@ describe('Controladores abm precios condiciones', function() { it('La funcion $scope.cancelar lleva a la ruta correcta', function() { inject(function($location) { //arrange - var scope = {}; + var scope = { + $watch: function() {}, + salir: function() {}, + formPrecioCondicion: '' + }; $controller('focaAbmPrecioCondicionController', { $scope: scope, focaAbmPreciosCondicionesService: { @@ -180,6 +192,7 @@ describe('Controladores abm precios condiciones', function() { focaBotoneraLateralService: {}, $routeParams: {}, $location: $location, + $localStorage: {}, focaModalService: {}, $timeout: timeout, $uibModal: {}, @@ -187,7 +200,7 @@ describe('Controladores abm precios condiciones', function() { }); //act - scope.cancelar(); + scope.salir(); //assert expect($location.url()).toEqual('/precio-condicion'); @@ -197,7 +210,9 @@ describe('Controladores abm precios condiciones', function() { it('La funcion $scope.guardar llama a servicio.guardarPrecioCondicion', function() { inject(function($location) { //arrange - var scope = {}; + var scope = { + $watch: function() { } + }; var focaAbmPreciosCondicionesService = { obtenerPrecioCondicion: function() { return { @@ -217,13 +232,21 @@ describe('Controladores abm precios condiciones', function() { focaBotoneraLateralService: {}, $routeParams: {}, $location: $location, - focaModalService: {}, + focaModalService: { + alert: function() {} + }, $timeout: timeout, $uibModal: {}, + $localStorage: {}, $window: window }); var promesaGuardarPrecioCondicion = Promise.resolve(true); - scope.precioCondicion = { listaPrecio: {} }; + scope.precioCondicion = { + listaPrecio: {}, + nombre: true, + descripcion: true, + idListaPrecio: true + }; //act //spyOn(window, 'location').and.returnValue({ assign: function() {} }); @@ -238,7 +261,9 @@ describe('Controladores abm precios condiciones', function() { it('La funcion $scope.solicitarConfirmacionPlazoPago levanta modal confirm', function() { //act - var scope = {}; + var scope = { + $watch: function() {} + }; var focaModalService = { confirm: function() { } }; @@ -257,6 +282,7 @@ describe('Controladores abm precios condiciones', function() { focaModalService: focaModalService, $timeout: timeout, $uibModal: {}, + $localStorage: {}, $window: {} }); @@ -271,7 +297,9 @@ describe('Controladores abm precios condiciones', function() { it('La funcion $scope.solicitarConfirmacionPlazoPago borra al dar ok', function(done) { //act - var scope = {}; + var scope = { + $watch: function() { } + }; var focaModalService = { confirm: function() { } }; @@ -291,6 +319,7 @@ describe('Controladores abm precios condiciones', function() { $location: {}, focaModalService: focaModalService, $timeout: timeout, + $localStorage: {}, $uibModal: {}, $window: {} }); @@ -313,7 +342,9 @@ describe('Controladores abm precios condiciones', function() { it('La funcion $scope.seleccionarListaPrecio levanta modal', function() { //arrange - var scope = {}; + var scope = { + $watch: function() {} + }; var uibModal = { open: function() { } }; @@ -333,6 +364,7 @@ describe('Controladores abm precios condiciones', function() { focaModalService: {}, $timeout: timeout, $uibModal: uibModal, + $localStorage: {}, $window: {} }); @@ -346,7 +378,9 @@ describe('Controladores abm precios condiciones', function() { it('La funcion $scope.verProductosListaPrecio levanta modal', function() { //arrange - var scope = {}; + var scope = { + $watch: function() {} + }; var uibModal = { open: function() { } }; @@ -366,6 +400,7 @@ describe('Controladores abm precios condiciones', function() { focaModalService: {}, $timeout: timeout, $uibModal: uibModal, + $localStorage: {}, $window: {} }); scope.precioCondicion = { @@ -381,7 +416,9 @@ describe('Controladores abm precios condiciones', function() { it('la función next suma uno a $scope.focused', function() { //arrange - var scope = {}; + var scope = { + $watch: function() {} + }; var focaAbmPreciosCondicionesService = { obtenerPrecioCondicion: function() { return { @@ -398,6 +435,7 @@ describe('Controladores abm precios condiciones', function() { focaModalService: {}, $timeout: timeout, $uibModal: {}, + $localStorage: {}, $window: {} }); -- 1.9.1