Commit 2b3468691564be2d8625625ab4148e0b91f39e38
1 parent
4abfac3b14
Exists in
master
unit test controladores
Showing
5 changed files
with
2247 additions
and
4 deletions
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const clean = require('gulp-clean'); | 2 | const clean = require('gulp-clean'); |
3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
6 | const uglify = require('gulp-uglify'); | 6 | const uglify = require('gulp-uglify'); |
7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
12 | const header = require('gulp-header'); | ||
13 | const footer = require('gulp-footer'); | ||
12 | 14 | ||
13 | var paths = { | 15 | var paths = { |
14 | srcJS: 'src/js/*.js', | 16 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 17 | srcViews: 'src/views/*.html', |
16 | specs: 'spec/*.js', | 18 | specs: 'spec/*.js', |
17 | tmp: 'tmp', | 19 | tmp: 'tmp', |
18 | dist: 'dist/' | 20 | dist: 'dist/' |
19 | }; | 21 | }; |
20 | 22 | ||
21 | gulp.task('templates', ['clean'], function() { | 23 | gulp.task('templates', ['clean'], function() { |
22 | return pump( | 24 | return pump( |
23 | [ | 25 | [ |
24 | gulp.src(paths.srcViews), | 26 | gulp.src(paths.srcViews), |
25 | htmlmin(), | 27 | htmlmin(), |
26 | templateCache('views.js', { | 28 | templateCache('views.js', { |
27 | module: 'focaCrearNotaPedido', | 29 | module: 'focaCrearNotaPedido', |
28 | root: '' | 30 | root: '' |
29 | }), | 31 | }), |
30 | gulp.dest(paths.tmp) | 32 | gulp.dest(paths.tmp) |
31 | ] | 33 | ] |
32 | ); | 34 | ); |
33 | }); | 35 | }); |
34 | 36 | ||
35 | gulp.task('uglify', ['templates'], function() { | 37 | gulp.task('uglify', ['templates', 'uglify-spec'], function() { |
36 | return pump( | 38 | return pump( |
37 | [ | 39 | [ |
38 | gulp.src([ | 40 | gulp.src([ |
39 | paths.srcJS, | 41 | paths.srcJS, |
40 | 'tmp/views.js' | 42 | 'tmp/views.js' |
41 | ]), | 43 | ]), |
42 | concat('foca-crear-nota-pedido.js'), | 44 | concat('foca-crear-nota-pedido.js'), |
43 | replace('src/views/', ''), | 45 | replace('src/views/', ''), |
44 | gulp.dest(paths.tmp), | 46 | gulp.dest(paths.tmp), |
45 | rename('foca-crear-nota-pedido.min.js'), | 47 | rename('foca-crear-nota-pedido.min.js'), |
46 | uglify(), | 48 | uglify(), |
47 | gulp.dest(paths.dist) | 49 | gulp.dest(paths.dist) |
48 | ] | 50 | ] |
49 | ); | 51 | ); |
50 | }); | 52 | }); |
51 | 53 | ||
54 | gulp.task('uglify-spec', function() { | ||
55 | return pump([ | ||
56 | gulp.src(paths.specs), | ||
57 | concat('foca-crear-nota-pedido.spec.js'), | ||
58 | replace("src/views/", ''), | ||
59 | header("describe('Módulo foca-crear-nota-pedido', function() { \n"), | ||
60 | footer("});"), | ||
61 | gulp.dest(paths.dist) | ||
62 | ]); | ||
63 | }); | ||
64 | |||
52 | gulp.task('clean', function() { | 65 | gulp.task('clean', function() { |
53 | return gulp.src(['tmp', 'dist'], {read: false}) | 66 | return gulp.src(['tmp', 'dist'], {read: false}) |
54 | .pipe(clean()); | 67 | .pipe(clean()); |
55 | }); | 68 | }); |
56 | 69 | ||
57 | gulp.task('pre-commit', function() { | 70 | gulp.task('pre-commit', function() { |
58 | return pump( | 71 | return pump( |
59 | [ | 72 | [ |
60 | gulp.src([paths.srcJS, paths.specs]), | 73 | gulp.src([paths.srcJS, paths.specs]), |
61 | jshint('.jshintrc'), | 74 | jshint('.jshintrc'), |
62 | jshint.reporter('default'), | 75 | jshint.reporter('default'), |
63 | jshint.reporter('fail') | 76 | jshint.reporter('fail') |
64 | ] | 77 | ] |
65 | ); | 78 | ); |
66 | 79 | ||
67 | gulp.start('uglify'); | 80 | gulp.start('uglify'); |
68 | }); | 81 | }); |
69 | 82 | ||
70 | gulp.task('webserver', function() { | 83 | gulp.task('webserver', function() { |
71 | pump [ | 84 | pump [ |
72 | connect.server({port: 3300, host: '0.0.0.0'}) | 85 | connect.server({port: 3300, host: '0.0.0.0'}) |
73 | ] | 86 | ] |
74 | }); | 87 | }); |
75 | 88 | ||
76 | gulp.task('clean-post-install', function() { | 89 | gulp.task('clean-post-install', function() { |
77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 90 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
78 | 'index.html'], {read: false}) | 91 | 'index.html', 'test.html', 'spec'], {read: false}) |
79 | .pipe(clean()); | 92 | .pipe(clean()); |
80 | }); | 93 | }); |
81 | 94 | ||
82 | gulp.task('default', ['webserver']); | 95 | gulp.task('default', ['webserver']); |
83 | 96 | ||
84 | gulp.task('watch', function() { | 97 | gulp.task('watch', function() { |
85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 98 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
86 | }); | 99 | }); |
87 | 100 | ||
88 | gulp.task('copy', ['uglify'], function() { | 101 | gulp.task('copy', ['uglify'], function() { |
89 | return gulp.src('dist/*.js') | 102 | return gulp.src('dist/*.js') |
90 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-nota-pedido/dist/')); | 103 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-nota-pedido/dist/')); |
91 | }); | 104 | }); |
92 | 105 | ||
93 | gulp.task('watchAndCopy', function() { | 106 | gulp.task('watchAndCopy', function() { |
94 | return gulp.watch([paths.srcJS], ['copy']); | 107 | return gulp.watch([paths.srcJS], ['copy']); |
95 | }); | 108 | }); |
96 | 109 |
spec/controllerSpec.js
File was created | 1 | describe('Controladores módulo crear nota de pedido', function() { | |
2 | |||
3 | var $controler; | ||
4 | |||
5 | beforeEach(function() { | ||
6 | module('focaCrearNotaPedido'); | ||
7 | inject(function(_$controller_) { | ||
8 | $controler = _$controller_; | ||
9 | }); | ||
10 | }); | ||
11 | |||
12 | describe('Controlador notaPedidoCtrl', function() { | ||
13 | |||
14 | var filter = function() { | ||
15 | return function() { }; | ||
16 | }; | ||
17 | var timeout; | ||
18 | |||
19 | beforeEach(function() { | ||
20 | |||
21 | inject(function($timeout) { | ||
22 | timeout = $timeout; | ||
23 | }); | ||
24 | }); | ||
25 | |||
26 | it('La función seleccionarNotaPedido levanta modal', function() { | ||
27 | //arrange | ||
28 | var scope = {}; | ||
29 | var uibModal = { | ||
30 | open: function() { } | ||
31 | }; | ||
32 | |||
33 | $controler('notaPedidoCtrl', { | ||
34 | $scope: scope, | ||
35 | $uibModal: uibModal, | ||
36 | $location: {}, | ||
37 | $filter: filter, | ||
38 | $timeout: timeout, | ||
39 | crearNotaPedidoService: { | ||
40 | getBotonera: function() { }, | ||
41 | getCotizacionByIdMoneda: function() { | ||
42 | return { | ||
43 | then: function() { } | ||
44 | }; | ||
45 | } | ||
46 | }, | ||
47 | focaBotoneraLateralService: {}, | ||
48 | focaModalService: {}, | ||
49 | notaPedidoBusinessService: {}, | ||
50 | $rootScope: { | ||
51 | $on: function() { } | ||
52 | }, | ||
53 | focaSeguimientoService: {}, | ||
54 | APP: {}, | ||
55 | focaLoginService: {} | ||
56 | }); | ||
57 | var respuesta = { result: { then: function() { } } }; | ||
58 | |||
59 | //act | ||
60 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
61 | scope.seleccionarNotaPedido(); | ||
62 | |||
63 | //assert | ||
64 | expect(uibModal.open).toHaveBeenCalled(); | ||
65 | }); | ||
66 | |||
67 | it('La función seleccionarNotaPedido llama a broadCast en promesa', function(done) { | ||
68 | //arrange | ||
69 | var scope = {}; | ||
70 | var uibModal = { | ||
71 | open: function() { } | ||
72 | }; | ||
73 | |||
74 | $controler('notaPedidoCtrl', { | ||
75 | $scope: scope, | ||
76 | $uibModal: uibModal, | ||
77 | $location: {}, | ||
78 | $filter: filter, | ||
79 | $timeout: timeout, | ||
80 | crearNotaPedidoService: { | ||
81 | getBotonera: function() { }, | ||
82 | getCotizacionByIdMoneda: function() { | ||
83 | return { | ||
84 | then: function() { } | ||
85 | }; | ||
86 | } | ||
87 | }, | ||
88 | focaBotoneraLateralService: {}, | ||
89 | focaModalService: {}, | ||
90 | notaPedidoBusinessService: { | ||
91 | plazoToString: function() { }, | ||
92 | calcularArticulos: function() { } | ||
93 | }, | ||
94 | $rootScope: { | ||
95 | $on: function() { } | ||
96 | }, | ||
97 | focaSeguimientoService: {}, | ||
98 | APP: {}, | ||
99 | focaLoginService: {} | ||
100 | }); | ||
101 | var notaPedido = { | ||
102 | cotizacion: { | ||
103 | moneda: {} | ||
104 | }, | ||
105 | cliente: {}, | ||
106 | vendedor: {}, | ||
107 | proveedor: {}, | ||
108 | notaPedidoPlazo: {}, | ||
109 | notaPedidoPuntoDescarga: [] | ||
110 | }; | ||
111 | var respuesta = { result: Promise.resolve(notaPedido) }; | ||
112 | |||
113 | //act | ||
114 | scope.notaPedido = {}; | ||
115 | scope.$broadcast = function() { }; | ||
116 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
117 | spyOn(scope, '$broadcast'); | ||
118 | scope.seleccionarNotaPedido(); | ||
119 | |||
120 | //assert | ||
121 | respuesta.result.then(function() { | ||
122 | expect(scope.$broadcast).toHaveBeenCalledWith('removeCabecera', 'Bomba:'); | ||
123 | expect(scope.$broadcast).toHaveBeenCalledWith('removeCabecera', 'Kilometros:'); | ||
124 | done(); | ||
125 | }); | ||
126 | }); | ||
127 | |||
128 | it('función seleccionarProductos muestra alerta cuando idLista undefined', function() { | ||
129 | //arrange | ||
130 | var scope = {}; | ||
131 | var focaModalService = { | ||
132 | alert: function() { } | ||
133 | }; | ||
134 | |||
135 | $controler('notaPedidoCtrl', { | ||
136 | $scope: scope, | ||
137 | $uibModal: {}, | ||
138 | $location: {}, | ||
139 | $filter: filter, | ||
140 | $timeout: timeout, | ||
141 | crearNotaPedidoService: { | ||
142 | getBotonera: function() { }, | ||
143 | getCotizacionByIdMoneda: function() { | ||
144 | return { | ||
145 | then: function() { } | ||
146 | }; | ||
147 | } | ||
148 | }, | ||
149 | focaBotoneraLateralService: {}, | ||
150 | focaModalService: focaModalService, | ||
151 | notaPedidoBusinessService: {}, | ||
152 | $rootScope: { | ||
153 | $on: function() { } | ||
154 | }, | ||
155 | focaSeguimientoService: {}, | ||
156 | APP: {}, | ||
157 | focaLoginService: {} | ||
158 | }); | ||
159 | |||
160 | //act | ||
161 | spyOn(focaModalService, 'alert'); | ||
162 | scope.idLista = undefined; | ||
163 | scope.seleccionarProductos(); | ||
164 | |||
165 | //assert | ||
166 | expect(focaModalService.alert) | ||
167 | .toHaveBeenCalledWith('Primero seleccione una lista de precio y condicion'); | ||
168 | }); | ||
169 | |||
170 | it('función seleccionarProductos abre modal', function() { | ||
171 | //arrange | ||
172 | var scope = {}; | ||
173 | var uibModal = { | ||
174 | open: function() { } | ||
175 | }; | ||
176 | |||
177 | $controler('notaPedidoCtrl', { | ||
178 | $scope: scope, | ||
179 | $uibModal: uibModal, | ||
180 | $location: {}, | ||
181 | $filter: filter, | ||
182 | $timeout: timeout, | ||
183 | crearNotaPedidoService: { | ||
184 | getBotonera: function() { }, | ||
185 | getCotizacionByIdMoneda: function() { | ||
186 | return { | ||
187 | then: function() { } | ||
188 | }; | ||
189 | } | ||
190 | }, | ||
191 | focaBotoneraLateralService: {}, | ||
192 | focaModalService: {}, | ||
193 | notaPedidoBusinessService: {}, | ||
194 | $rootScope: { | ||
195 | $on: function() { } | ||
196 | }, | ||
197 | focaSeguimientoService: {}, | ||
198 | APP: {}, | ||
199 | focaLoginService: {} | ||
200 | }); | ||
201 | scope.idLista = true; | ||
202 | scope.notaPedido = { | ||
203 | cotizacion: {}, | ||
204 | moneda: {} | ||
205 | }; | ||
206 | var respuesta = { result: {then: function() { } } }; | ||
207 | |||
208 | //act | ||
209 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
210 | scope.seleccionarProductos(); | ||
211 | |||
212 | //assert | ||
213 | expect(uibModal.open).toHaveBeenCalled(); | ||
214 | }); | ||
215 | |||
216 | it('función seleccionarPuntosDeDescarga muestra alerta cuando cliente y domicilio son' + | ||
217 | 'undefined', function() | ||
218 | { | ||
219 | //arrange | ||
220 | var scope = {}; | ||
221 | var focaModalService = { | ||
222 | alert: function() { } | ||
223 | }; | ||
224 | |||
225 | $controler('notaPedidoCtrl', { | ||
226 | $scope: scope, | ||
227 | $uibModal: {}, | ||
228 | $location: {}, | ||
229 | $filter: filter, | ||
230 | $timeout: timeout, | ||
231 | crearNotaPedidoService: { | ||
232 | getBotonera: function() { }, | ||
233 | getCotizacionByIdMoneda: function() { | ||
234 | return { | ||
235 | then: function() { } | ||
236 | }; | ||
237 | } | ||
238 | }, | ||
239 | focaBotoneraLateralService: {}, | ||
240 | focaModalService: focaModalService, | ||
241 | notaPedidoBusinessService: {}, | ||
242 | $rootScope: { | ||
243 | $on: function() { } | ||
244 | }, | ||
245 | focaSeguimientoService: {}, | ||
246 | APP: {}, | ||
247 | focaLoginService: {} | ||
248 | }); | ||
249 | scope.idLista = true; | ||
250 | scope.notaPedido = { | ||
251 | cliente: { COD: false }, | ||
252 | domicilio: { id: false} | ||
253 | }; | ||
254 | |||
255 | //act | ||
256 | spyOn(focaModalService, 'alert'); | ||
257 | scope.seleccionarPuntosDeDescarga(); | ||
258 | |||
259 | //assert | ||
260 | expect(focaModalService.alert).toHaveBeenCalled(); | ||
261 | }); | ||
262 | |||
263 | it('función seleccionarPuntosDeDescarga abre modal', function() { | ||
264 | //arrange | ||
265 | var scope = {}; | ||
266 | var uibModal = { | ||
267 | open: function() { } | ||
268 | }; | ||
269 | |||
270 | $controler('notaPedidoCtrl', { | ||
271 | $scope: scope, | ||
272 | $uibModal: uibModal, | ||
273 | $location: {}, | ||
274 | $filter: filter, | ||
275 | $timeout: timeout, | ||
276 | crearNotaPedidoService: { | ||
277 | getBotonera: function() { }, | ||
278 | getCotizacionByIdMoneda: function() { | ||
279 | return { | ||
280 | then: function() { } | ||
281 | }; | ||
282 | } | ||
283 | }, | ||
284 | focaBotoneraLateralService: {}, | ||
285 | focaModalService: {}, | ||
286 | notaPedidoBusinessService: {}, | ||
287 | $rootScope: { | ||
288 | $on: function() { } | ||
289 | }, | ||
290 | focaSeguimientoService: {}, | ||
291 | APP: {}, | ||
292 | focaLoginService: {} | ||
293 | }); | ||
294 | scope.idLista = true; | ||
295 | scope.notaPedido = { | ||
296 | cliente: { COD: true }, | ||
297 | domicilio: { id: true } | ||
298 | }; | ||
299 | var respuesta = { result: { then: function() { } } }; | ||
300 | |||
301 | //act | ||
302 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
303 | scope.seleccionarPuntosDeDescarga(); | ||
304 | |||
305 | //assert | ||
306 | expect(uibModal.open).toHaveBeenCalled(); | ||
307 | }); | ||
308 | |||
309 | it('función seleccionarPuntosDeDescarga setea punto elegido', function(done) { | ||
310 | //arrange | ||
311 | var scope = {}; | ||
312 | var uibModal = { | ||
313 | open: function() { } | ||
314 | }; | ||
315 | |||
316 | $controler('notaPedidoCtrl', { | ||
317 | $scope: scope, | ||
318 | $uibModal: uibModal, | ||
319 | $location: {}, | ||
320 | $filter: filter, | ||
321 | $timeout: timeout, | ||
322 | crearNotaPedidoService: { | ||
323 | getBotonera: function() { }, | ||
324 | getCotizacionByIdMoneda: function() { | ||
325 | return { | ||
326 | then: function() { } | ||
327 | }; | ||
328 | } | ||
329 | }, | ||
330 | focaBotoneraLateralService: {}, | ||
331 | focaModalService: {}, | ||
332 | notaPedidoBusinessService: {}, | ||
333 | $rootScope: { | ||
334 | $on: function() { } | ||
335 | }, | ||
336 | focaSeguimientoService: {}, | ||
337 | APP: {}, | ||
338 | focaLoginService: {} | ||
339 | }); | ||
340 | scope.idLista = true; | ||
341 | scope.notaPedido = { | ||
342 | cliente: { COD: true }, | ||
343 | domicilio: { id: true } | ||
344 | }; | ||
345 | var respuesta = []; | ||
346 | var promiseRespuesta = { result: Promise.resolve(respuesta) }; | ||
347 | scope.$broadcast = function() { }; | ||
348 | |||
349 | //act | ||
350 | spyOn(uibModal, 'open').and.returnValue(promiseRespuesta); | ||
351 | scope.seleccionarPuntosDeDescarga(); | ||
352 | |||
353 | //assert | ||
354 | promiseRespuesta.result.then(function() { | ||
355 | expect(scope.notaPedido.puntosDescarga).toEqual(respuesta); | ||
356 | done(); | ||
357 | }); | ||
358 | }); | ||
359 | |||
360 | it('función seleccionarVendedor abre modal', function() { | ||
361 | //arrange | ||
362 | var scope = {}; | ||
363 | var focaModalService = { | ||
364 | modal: function() { } | ||
365 | }; | ||
366 | |||
367 | $controler('notaPedidoCtrl', { | ||
368 | $scope: scope, | ||
369 | $uibModal: {}, | ||
370 | $location: {}, | ||
371 | $filter: filter, | ||
372 | $timeout: timeout, | ||
373 | crearNotaPedidoService: { | ||
374 | getBotonera: function() { }, | ||
375 | getCotizacionByIdMoneda: function() { | ||
376 | return { | ||
377 | then: function() { } | ||
378 | }; | ||
379 | } | ||
380 | }, | ||
381 | focaBotoneraLateralService: {}, | ||
382 | focaModalService: focaModalService, | ||
383 | notaPedidoBusinessService: {}, | ||
384 | $rootScope: { | ||
385 | $on: function() { } | ||
386 | }, | ||
387 | focaSeguimientoService: {}, | ||
388 | APP: {}, | ||
389 | focaLoginService: {} | ||
390 | }); | ||
391 | scope.idLista = true; | ||
392 | scope.notaPedido = { | ||
393 | cliente: { COD: true }, | ||
394 | domicilio: { id: true } | ||
395 | }; | ||
396 | |||
397 | var respuesta = { then: function() { } }; | ||
398 | |||
399 | //act | ||
400 | spyOn(focaModalService, 'modal').and.returnValue(respuesta); | ||
401 | scope.seleccionarVendedor(); | ||
402 | |||
403 | //assert | ||
404 | expect(focaModalService.modal).toHaveBeenCalled(); | ||
405 | }); | ||
406 | |||
407 | it('función seleccionarVendedor setea vendedor y cabecera', function(done) { | ||
408 | //arrange | ||
409 | var scope = {}; | ||
410 | var focaModalService = { | ||
411 | modal: function() { } | ||
412 | }; | ||
413 | |||
414 | $controler('notaPedidoCtrl', { | ||
415 | $scope: scope, | ||
416 | $uibModal: {}, | ||
417 | $location: {}, | ||
418 | $filter: filter, | ||
419 | $timeout: timeout, | ||
420 | crearNotaPedidoService: { | ||
421 | getBotonera: function() { }, | ||
422 | getCotizacionByIdMoneda: function() { | ||
423 | return { | ||
424 | then: function() { } | ||
425 | }; | ||
426 | } | ||
427 | }, | ||
428 | focaBotoneraLateralService: {}, | ||
429 | focaModalService: focaModalService, | ||
430 | notaPedidoBusinessService: {}, | ||
431 | $rootScope: { | ||
432 | $on: function() { } | ||
433 | }, | ||
434 | focaSeguimientoService: {}, | ||
435 | APP: {}, | ||
436 | focaLoginService: {} | ||
437 | }); | ||
438 | scope.idLista = true; | ||
439 | scope.notaPedido = { | ||
440 | cliente: { COD: true }, | ||
441 | domicilio: { id: true } | ||
442 | }; | ||
443 | var respuesta = {}; | ||
444 | var promesaRespuesta = Promise.resolve(respuesta); | ||
445 | scope.$broadcast = function() { }; | ||
446 | |||
447 | //act | ||
448 | spyOn(focaModalService, 'modal').and.returnValue(promesaRespuesta); | ||
449 | spyOn(scope, '$broadcast'); | ||
450 | scope.seleccionarVendedor(); | ||
451 | |||
452 | //assert | ||
453 | promesaRespuesta.then(function() { | ||
454 | expect(scope.notaPedido.vendedor).toEqual(respuesta); | ||
455 | expect(scope.$broadcast).toHaveBeenCalled(); | ||
456 | done(); | ||
457 | }); | ||
458 | }); | ||
459 | |||
460 | it('función seleccionarProveedor abre modal', function() { | ||
461 | //arrange | ||
462 | var scope = {}; | ||
463 | var focaModalService = { | ||
464 | modal: function() { } | ||
465 | }; | ||
466 | |||
467 | $controler('notaPedidoCtrl', { | ||
468 | $scope: scope, | ||
469 | $uibModal: {}, | ||
470 | $location: {}, | ||
471 | $filter: filter, | ||
472 | $timeout: timeout, | ||
473 | crearNotaPedidoService: { | ||
474 | getBotonera: function() { }, | ||
475 | getCotizacionByIdMoneda: function() { | ||
476 | return { | ||
477 | then: function() { } | ||
478 | }; | ||
479 | } | ||
480 | }, | ||
481 | focaBotoneraLateralService: {}, | ||
482 | focaModalService: focaModalService, | ||
483 | notaPedidoBusinessService: {}, | ||
484 | $rootScope: { | ||
485 | $on: function() { } | ||
486 | }, | ||
487 | focaSeguimientoService: {}, | ||
488 | APP: {}, | ||
489 | focaLoginService: {} | ||
490 | }); | ||
491 | scope.notaPedido = {}; | ||
492 | |||
493 | var respuesta = { then: function() { } }; | ||
494 | |||
495 | //act | ||
496 | spyOn(focaModalService, 'modal').and.returnValue(respuesta); | ||
497 | scope.seleccionarProveedor(); | ||
498 | |||
499 | //assert | ||
500 | expect(focaModalService.modal).toHaveBeenCalled(); | ||
501 | }); | ||
502 | |||
503 | it('función seleccionarProveedor setea vendedor y cabecera', function(done) { | ||
504 | //arrange | ||
505 | var scope = {}; | ||
506 | var focaModalService = { | ||
507 | modal: function() { } | ||
508 | }; | ||
509 | |||
510 | $controler('notaPedidoCtrl', { | ||
511 | $scope: scope, | ||
512 | $uibModal: {}, | ||
513 | $location: {}, | ||
514 | $filter: filter, | ||
515 | $timeout: timeout, | ||
516 | crearNotaPedidoService: { | ||
517 | getBotonera: function() { }, | ||
518 | getCotizacionByIdMoneda: function() { | ||
519 | return { | ||
520 | then: function() { } | ||
521 | }; | ||
522 | } | ||
523 | }, | ||
524 | focaBotoneraLateralService: {}, | ||
525 | focaModalService: focaModalService, | ||
526 | notaPedidoBusinessService: {}, | ||
527 | $rootScope: { | ||
528 | $on: function() { } | ||
529 | }, | ||
530 | focaSeguimientoService: {}, | ||
531 | APP: {}, | ||
532 | focaLoginService: {} | ||
533 | }); | ||
534 | |||
535 | scope.notaPedido = {}; | ||
536 | var respuesta = {}; | ||
537 | var promesaRespuesta = Promise.resolve(respuesta); | ||
538 | scope.$broadcast = function() { }; | ||
539 | |||
540 | //act | ||
541 | spyOn(focaModalService, 'modal').and.returnValue(promesaRespuesta); | ||
542 | spyOn(scope, '$broadcast'); | ||
543 | scope.seleccionarProveedor(); | ||
544 | |||
545 | //assert | ||
546 | promesaRespuesta.then(function() { | ||
547 | expect(scope.notaPedido.proveedor).toEqual(respuesta); | ||
548 | expect(scope.$broadcast).toHaveBeenCalled(); | ||
549 | done(); | ||
550 | }); | ||
551 | }); | ||
552 | |||
553 | it('función seleccionarCliente abre alerta cuando no se elije vendedor', function() { | ||
554 | //arrange | ||
555 | var scope = {}; | ||
556 | var focaModalService = { | ||
557 | alert: function() { } | ||
558 | }; | ||
559 | |||
560 | $controler('notaPedidoCtrl', { | ||
561 | $scope: scope, | ||
562 | $uibModal: {}, | ||
563 | $location: {}, | ||
564 | $filter: filter, | ||
565 | $timeout: timeout, | ||
566 | crearNotaPedidoService: { | ||
567 | getBotonera: function() { }, | ||
568 | getCotizacionByIdMoneda: function() { | ||
569 | return { | ||
570 | then: function() { } | ||
571 | }; | ||
572 | } | ||
573 | }, | ||
574 | focaBotoneraLateralService: {}, | ||
575 | focaModalService: focaModalService, | ||
576 | notaPedidoBusinessService: {}, | ||
577 | $rootScope: { | ||
578 | $on: function() { } | ||
579 | }, | ||
580 | focaSeguimientoService: {}, | ||
581 | APP: {}, | ||
582 | focaLoginService: {} | ||
583 | }); | ||
584 | scope.notaPedido = { | ||
585 | vendedor: { NUM: false } | ||
586 | }; | ||
587 | |||
588 | //act | ||
589 | spyOn(focaModalService, 'alert'); | ||
590 | scope.seleccionarCliente(); | ||
591 | |||
592 | //assert | ||
593 | expect(focaModalService.alert).toHaveBeenCalledWith('Primero seleccione un vendedor'); | ||
594 | }); | ||
595 | |||
596 | it('función seleccionarCliente abre modal', function() { | ||
597 | //arrange | ||
598 | var scope = {}; | ||
599 | var uibModal = { | ||
600 | open: function() { } | ||
601 | }; | ||
602 | |||
603 | $controler('notaPedidoCtrl', { | ||
604 | $scope: scope, | ||
605 | $uibModal: uibModal, | ||
606 | $location: {}, | ||
607 | $filter: filter, | ||
608 | $timeout: timeout, | ||
609 | crearNotaPedidoService: { | ||
610 | getBotonera: function() { }, | ||
611 | getCotizacionByIdMoneda: function() { | ||
612 | return { | ||
613 | then: function() { } | ||
614 | }; | ||
615 | } | ||
616 | }, | ||
617 | focaBotoneraLateralService: {}, | ||
618 | focaModalService: {}, | ||
619 | notaPedidoBusinessService: {}, | ||
620 | $rootScope: { | ||
621 | $on: function() { } | ||
622 | }, | ||
623 | focaSeguimientoService: {}, | ||
624 | APP: {}, | ||
625 | focaLoginService: {} | ||
626 | }); | ||
627 | scope.notaPedido = { | ||
628 | vendedor: { NUM: true } | ||
629 | }; | ||
630 | |||
631 | var respuesta = { result: {then: function() { } } }; | ||
632 | |||
633 | //act | ||
634 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
635 | scope.seleccionarCliente(); | ||
636 | |||
637 | //assert | ||
638 | expect(uibModal.open).toHaveBeenCalled(); | ||
639 | }); | ||
640 | |||
641 | it('función seleccionarCliente setea vendedor y llama a domicilios', function(done) { | ||
642 | |||
643 | //arrange | ||
644 | var scope = {}; | ||
645 | var uibModal = { | ||
646 | open: function() { } | ||
647 | }; | ||
648 | |||
649 | $controler('notaPedidoCtrl', { | ||
650 | $scope: scope, | ||
651 | $uibModal: uibModal, | ||
652 | $location: {}, | ||
653 | $filter: filter, | ||
654 | $timeout: timeout, | ||
655 | crearNotaPedidoService: { | ||
656 | getBotonera: function() { }, | ||
657 | getCotizacionByIdMoneda: function() { | ||
658 | return { | ||
659 | then: function() { } | ||
660 | }; | ||
661 | } | ||
662 | }, | ||
663 | focaBotoneraLateralService: {}, | ||
664 | focaModalService: {}, | ||
665 | notaPedidoBusinessService: {}, | ||
666 | $rootScope: { | ||
667 | $on: function() { } | ||
668 | }, | ||
669 | focaSeguimientoService: {}, | ||
670 | APP: {}, | ||
671 | focaLoginService: {} | ||
672 | }); | ||
673 | scope.idLista = true; | ||
674 | scope.notaPedido = { | ||
675 | vendedor: { NUM: true } | ||
676 | }; | ||
677 | var respuesta = {}; | ||
678 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; | ||
679 | |||
680 | //act | ||
681 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); | ||
682 | spyOn(scope, 'abrirModalDomicilios'); | ||
683 | scope.seleccionarCliente(); | ||
684 | |||
685 | //assert | ||
686 | promesaRespuesta.result.then(function() { | ||
687 | expect(scope.cliente).toEqual(respuesta); | ||
688 | expect(scope.abrirModalDomicilios).toHaveBeenCalled(); | ||
689 | done(); | ||
690 | }); | ||
691 | }); | ||
692 | |||
693 | it('función abrirModalDomicilios abre modal', function() { | ||
694 | //arrange | ||
695 | var scope = {}; | ||
696 | var uibModal = { | ||
697 | open: function() { } | ||
698 | }; | ||
699 | |||
700 | $controler('notaPedidoCtrl', { | ||
701 | $scope: scope, | ||
702 | $uibModal: uibModal, | ||
703 | $location: {}, | ||
704 | $filter: filter, | ||
705 | $timeout: timeout, | ||
706 | crearNotaPedidoService: { | ||
707 | getBotonera: function() { }, | ||
708 | getCotizacionByIdMoneda: function() { | ||
709 | return { | ||
710 | then: function() { } | ||
711 | }; | ||
712 | } | ||
713 | }, | ||
714 | focaBotoneraLateralService: {}, | ||
715 | focaModalService: {}, | ||
716 | notaPedidoBusinessService: {}, | ||
717 | $rootScope: { | ||
718 | $on: function() { } | ||
719 | }, | ||
720 | focaSeguimientoService: {}, | ||
721 | APP: {}, | ||
722 | focaLoginService: {} | ||
723 | }); | ||
724 | |||
725 | var respuesta = { result: {then: function() { } } }; | ||
726 | |||
727 | //act | ||
728 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
729 | scope.abrirModalDomicilios(); | ||
730 | |||
731 | //assert | ||
732 | expect(uibModal.open).toHaveBeenCalled(); | ||
733 | }); | ||
734 | |||
735 | it('función abrirModalDomicilios setea domicilio, cliente y cabeceras', function(done) { | ||
736 | |||
737 | //arrange | ||
738 | var scope = {}; | ||
739 | var uibModal = { | ||
740 | open: function() { } | ||
741 | }; | ||
742 | |||
743 | $controler('notaPedidoCtrl', { | ||
744 | $scope: scope, | ||
745 | $uibModal: uibModal, | ||
746 | $location: {}, | ||
747 | $filter: filter, | ||
748 | $timeout: timeout, | ||
749 | crearNotaPedidoService: { | ||
750 | getBotonera: function() { }, | ||
751 | getCotizacionByIdMoneda: function() { | ||
752 | return { | ||
753 | then: function() { } | ||
754 | }; | ||
755 | }, | ||
756 | getPuntosDescargaByClienDom: function() { | ||
757 | return { | ||
758 | then: function() { } | ||
759 | }; | ||
760 | } | ||
761 | }, | ||
762 | focaBotoneraLateralService: {}, | ||
763 | focaModalService: {}, | ||
764 | notaPedidoBusinessService: {}, | ||
765 | $rootScope: { | ||
766 | $on: function() { } | ||
767 | }, | ||
768 | focaSeguimientoService: {}, | ||
769 | APP: {}, | ||
770 | focaLoginService: {} | ||
771 | }); | ||
772 | scope.idLista = true; | ||
773 | scope.notaPedido = { | ||
774 | vendedor: { NUM: true } | ||
775 | }; | ||
776 | var respuesta = {}; | ||
777 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; | ||
778 | scope.$broadcast = function() { }; | ||
779 | var cliente = { | ||
780 | COD: undefined, | ||
781 | CUIT: undefined, | ||
782 | NOM: undefined | ||
783 | }; | ||
784 | |||
785 | //act | ||
786 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); | ||
787 | spyOn(scope, '$broadcast'); | ||
788 | scope.abrirModalDomicilios({ }); | ||
789 | |||
790 | //assert | ||
791 | promesaRespuesta.result.then(function() { | ||
792 | expect(scope.notaPedido.domicilio).toEqual(respuesta); | ||
793 | expect(scope.notaPedido.cliente).toEqual(cliente); | ||
794 | expect(scope.$broadcast).toHaveBeenCalled(); | ||
795 | done(); | ||
796 | }); | ||
797 | }); | ||
798 | |||
799 | it('función getTotal devulve correctamente', function() { | ||
800 | |||
801 | //arrange | ||
802 | var scope = {}; | ||
803 | |||
804 | $controler('notaPedidoCtrl', { | ||
805 | $scope: scope, | ||
806 | $uibModal: {}, | ||
807 | $location: {}, | ||
808 | $filter: filter, | ||
809 | $timeout: timeout, | ||
810 | crearNotaPedidoService: { | ||
811 | getBotonera: function() { }, | ||
812 | getCotizacionByIdMoneda: function() { | ||
813 | return { | ||
814 | then: function() { } | ||
815 | }; | ||
816 | } | ||
817 | }, | ||
818 | focaBotoneraLateralService: {}, | ||
819 | focaModalService: {}, | ||
820 | notaPedidoBusinessService: {}, | ||
821 | $rootScope: { | ||
822 | $on: function() { } | ||
823 | }, | ||
824 | focaSeguimientoService: {}, | ||
825 | APP: {}, | ||
826 | focaLoginService: {} | ||
827 | }); | ||
828 | scope.idLista = true; | ||
829 | scope.notaPedido = { | ||
830 | vendedor: { NUM: true } | ||
831 | }; | ||
832 | |||
833 | //act | ||
834 | scope.articulosTabla = [{ precio: 2, cantidad: 1}]; | ||
835 | var esperado = 2; | ||
836 | var resultado = scope.getTotal(); | ||
837 | |||
838 | //assert | ||
839 | expect(resultado).toEqual(esperado); | ||
840 | }); | ||
841 | |||
842 | it('función getSubTotal devulve correctamente', function() { | ||
843 | |||
844 | //arrange | ||
845 | var scope = {}; | ||
846 | |||
847 | $controler('notaPedidoCtrl', { | ||
848 | $scope: scope, | ||
849 | $uibModal: {}, | ||
850 | $location: {}, | ||
851 | $filter: filter, | ||
852 | $timeout: timeout, | ||
853 | crearNotaPedidoService: { | ||
854 | getBotonera: function() { }, | ||
855 | getCotizacionByIdMoneda: function() { | ||
856 | return { | ||
857 | then: function() { } | ||
858 | }; | ||
859 | } | ||
860 | }, | ||
861 | focaBotoneraLateralService: {}, | ||
862 | focaModalService: {}, | ||
863 | notaPedidoBusinessService: {}, | ||
864 | $rootScope: { | ||
865 | $on: function() { } | ||
866 | }, | ||
867 | focaSeguimientoService: {}, | ||
868 | APP: {}, | ||
869 | focaLoginService: {} | ||
870 | }); | ||
871 | scope.idLista = true; | ||
872 | scope.notaPedido = { | ||
873 | vendedor: { NUM: true } | ||
874 | }; | ||
875 | |||
876 | //act | ||
877 | scope.articuloACargar = { precio: 2, cantidad: 1}; | ||
878 | var esperado = 2; | ||
879 | var resultado = scope.getSubTotal(); | ||
880 | |||
881 | //assert | ||
882 | expect(resultado).toEqual(esperado); | ||
883 | }); | ||
884 | |||
885 | it('función seleccionarPreciosYCondiciones abre modal', function() { | ||
886 | |||
887 | //arrange | ||
888 | var scope = {}; | ||
889 | var uibModal = { | ||
890 | open: function() { } | ||
891 | }; | ||
892 | |||
893 | $controler('notaPedidoCtrl', { | ||
894 | $scope: scope, | ||
895 | $uibModal: uibModal, | ||
896 | $location: {}, | ||
897 | $filter: filter, | ||
898 | $timeout: timeout, | ||
899 | crearNotaPedidoService: { | ||
900 | getBotonera: function() { }, | ||
901 | getCotizacionByIdMoneda: function() { | ||
902 | return { | ||
903 | then: function() { } | ||
904 | }; | ||
905 | } | ||
906 | }, | ||
907 | focaBotoneraLateralService: {}, | ||
908 | focaModalService: {}, | ||
909 | notaPedidoBusinessService: {}, | ||
910 | $rootScope: { | ||
911 | $on: function() { } | ||
912 | }, | ||
913 | focaSeguimientoService: {}, | ||
914 | APP: {}, | ||
915 | focaLoginService: {} | ||
916 | }); | ||
917 | |||
918 | scope.notaPedido = {}; | ||
919 | |||
920 | var respuesta = { result: {then: function() { } } }; | ||
921 | |||
922 | //act | ||
923 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
924 | scope.seleccionarPreciosYCondiciones(); | ||
925 | |||
926 | //assert | ||
927 | expect(uibModal.open).toHaveBeenCalled(); | ||
928 | }); | ||
929 | |||
930 | it('función seleccionarPreciosYCondiciones setea articulos y cabecera', function(done) { | ||
931 | |||
932 | //arrange | ||
933 | var scope = {}; | ||
934 | var uibModal = { | ||
935 | open: function() { } | ||
936 | }; | ||
937 | |||
938 | $controler('notaPedidoCtrl', { | ||
939 | $scope: scope, | ||
940 | $uibModal: uibModal, | ||
941 | $location: {}, | ||
942 | $filter: filter, | ||
943 | $timeout: timeout, | ||
944 | crearNotaPedidoService: { | ||
945 | getBotonera: function() { }, | ||
946 | getCotizacionByIdMoneda: function() { | ||
947 | return { | ||
948 | then: function() { } | ||
949 | }; | ||
950 | } | ||
951 | }, | ||
952 | focaBotoneraLateralService: {}, | ||
953 | focaModalService: {}, | ||
954 | notaPedidoBusinessService: {}, | ||
955 | $rootScope: { | ||
956 | $on: function() { } | ||
957 | }, | ||
958 | focaSeguimientoService: {}, | ||
959 | APP: {}, | ||
960 | focaLoginService: {} | ||
961 | }); | ||
962 | scope.idLista = true; | ||
963 | scope.notaPedido = { | ||
964 | vendedor: { NUM: true } | ||
965 | }; | ||
966 | var respuesta = { plazoPago: { } }; | ||
967 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; | ||
968 | scope.$broadcast = function() { }; | ||
969 | |||
970 | //act | ||
971 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); | ||
972 | spyOn(scope, '$broadcast'); | ||
973 | scope.seleccionarPreciosYCondiciones(); | ||
974 | |||
975 | //assert | ||
976 | promesaRespuesta.result.then(function() { | ||
977 | expect(scope.articulosTabla.length).toEqual(0); | ||
978 | expect(scope.$broadcast).toHaveBeenCalled(); | ||
979 | done(); | ||
980 | }); | ||
981 | }); | ||
982 | |||
983 | it('función seleccionarFlete abre modal', function() { | ||
984 | |||
985 | //arrange | ||
986 | var scope = {}; | ||
987 | var uibModal = { | ||
988 | open: function() { } | ||
989 | }; | ||
990 | |||
991 | $controler('notaPedidoCtrl', { | ||
992 | $scope: scope, | ||
993 | $uibModal: uibModal, | ||
994 | $location: {}, | ||
995 | $filter: filter, | ||
996 | $timeout: timeout, | ||
997 | crearNotaPedidoService: { | ||
998 | getBotonera: function() { }, | ||
999 | getCotizacionByIdMoneda: function() { | ||
1000 | return { | ||
1001 | then: function() { } | ||
1002 | }; | ||
1003 | } | ||
1004 | }, | ||
1005 | focaBotoneraLateralService: {}, | ||
1006 | focaModalService: {}, | ||
1007 | notaPedidoBusinessService: {}, | ||
1008 | $rootScope: { | ||
1009 | $on: function() { } | ||
1010 | }, | ||
1011 | focaSeguimientoService: {}, | ||
1012 | APP: {}, | ||
1013 | focaLoginService: {} | ||
1014 | }); | ||
1015 | |||
1016 | scope.notaPedido = {}; | ||
1017 | |||
1018 | var respuesta = { result: {then: function() { } } }; | ||
1019 | |||
1020 | //act | ||
1021 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
1022 | scope.seleccionarFlete(); | ||
1023 | |||
1024 | //assert | ||
1025 | expect(uibModal.open).toHaveBeenCalled(); | ||
1026 | }); | ||
1027 | |||
1028 | it('función seleccionarFlete setea flete y cabecera', function(done) { | ||
1029 | |||
1030 | //arrange | ||
1031 | var scope = {}; | ||
1032 | var uibModal = { | ||
1033 | open: function() { } | ||
1034 | }; | ||
1035 | |||
1036 | $controler('notaPedidoCtrl', { | ||
1037 | $scope: scope, | ||
1038 | $uibModal: uibModal, | ||
1039 | $location: {}, | ||
1040 | $filter: filter, | ||
1041 | $timeout: timeout, | ||
1042 | crearNotaPedidoService: { | ||
1043 | getBotonera: function() { }, | ||
1044 | getCotizacionByIdMoneda: function() { | ||
1045 | return { | ||
1046 | then: function() { } | ||
1047 | }; | ||
1048 | } | ||
1049 | }, | ||
1050 | focaBotoneraLateralService: {}, | ||
1051 | focaModalService: {}, | ||
1052 | notaPedidoBusinessService: {}, | ||
1053 | $rootScope: { | ||
1054 | $on: function() { } | ||
1055 | }, | ||
1056 | focaSeguimientoService: {}, | ||
1057 | APP: {}, | ||
1058 | focaLoginService: {} | ||
1059 | }); | ||
1060 | scope.idLista = true; | ||
1061 | scope.notaPedido = { | ||
1062 | vendedor: { NUM: true } | ||
1063 | }; | ||
1064 | var respuesta = { flete: 1, FOB: 2, bomba: 3, kilometros: 4 }; | ||
1065 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; | ||
1066 | scope.$broadcast = function() { }; | ||
1067 | |||
1068 | //act | ||
1069 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); | ||
1070 | spyOn(scope, '$broadcast'); | ||
1071 | scope.seleccionarFlete(); | ||
1072 | |||
1073 | //assert | ||
1074 | |||
1075 | promesaRespuesta.result.then(function() { | ||
1076 | expect(scope.notaPedido.flete).toEqual(respuesta.flete); | ||
1077 | expect(scope.notaPedido.fob).toEqual(respuesta.FOB); | ||
1078 | expect(scope.notaPedido.bomba).toEqual(respuesta.bomba); | ||
1079 | expect(scope.notaPedido.kilometros).toEqual(respuesta.kilometros); | ||
1080 | expect(scope.$broadcast).toHaveBeenCalled(); | ||
1081 | done(); | ||
1082 | }); | ||
1083 | }); | ||
1084 | |||
1085 | it('función seleccionarMoneda abre modal', function() { | ||
1086 | //arrange | ||
1087 | var scope = {}; | ||
1088 | var focaModalService = { | ||
1089 | modal: function() { } | ||
1090 | }; | ||
1091 | |||
1092 | $controler('notaPedidoCtrl', { | ||
1093 | $scope: scope, | ||
1094 | $uibModal: {}, | ||
1095 | $location: {}, | ||
1096 | $filter: filter, | ||
1097 | $timeout: timeout, | ||
1098 | crearNotaPedidoService: { | ||
1099 | getBotonera: function() { }, | ||
1100 | getCotizacionByIdMoneda: function() { | ||
1101 | return { | ||
1102 | then: function() { } | ||
1103 | }; | ||
1104 | } | ||
1105 | }, | ||
1106 | focaBotoneraLateralService: {}, | ||
1107 | focaModalService: focaModalService, | ||
1108 | notaPedidoBusinessService: {}, | ||
1109 | $rootScope: { | ||
1110 | $on: function() { } | ||
1111 | }, | ||
1112 | focaSeguimientoService: {}, | ||
1113 | APP: {}, | ||
1114 | focaLoginService: {} | ||
1115 | }); | ||
1116 | scope.notaPedido = {}; | ||
1117 | |||
1118 | var respuesta = { then: function() { } }; | ||
1119 | |||
1120 | //act | ||
1121 | spyOn(focaModalService, 'modal').and.returnValue(respuesta); | ||
1122 | scope.seleccionarMoneda(); | ||
1123 | |||
1124 | //assert | ||
1125 | expect(focaModalService.modal).toHaveBeenCalled(); | ||
1126 | }); | ||
1127 | |||
1128 | it('función seleccionarMoneda llama Modal Cotizacion', function(done) { | ||
1129 | //arrange | ||
1130 | var scope = {}; | ||
1131 | var focaModalService = { | ||
1132 | modal: function() { } | ||
1133 | }; | ||
1134 | |||
1135 | $controler('notaPedidoCtrl', { | ||
1136 | $scope: scope, | ||
1137 | $uibModal: {}, | ||
1138 | $location: {}, | ||
1139 | $filter: filter, | ||
1140 | $timeout: timeout, | ||
1141 | crearNotaPedidoService: { | ||
1142 | getBotonera: function() { }, | ||
1143 | getCotizacionByIdMoneda: function() { | ||
1144 | return { | ||
1145 | then: function() { } | ||
1146 | }; | ||
1147 | } | ||
1148 | }, | ||
1149 | focaBotoneraLateralService: {}, | ||
1150 | focaModalService: focaModalService, | ||
1151 | notaPedidoBusinessService: {}, | ||
1152 | $rootScope: { | ||
1153 | $on: function() { } | ||
1154 | }, | ||
1155 | focaSeguimientoService: {}, | ||
1156 | APP: {}, | ||
1157 | focaLoginService: {} | ||
1158 | }); | ||
1159 | |||
1160 | scope.notaPedido = {}; | ||
1161 | var respuesta = 'test'; | ||
1162 | var promesaRespuesta = Promise.resolve(respuesta); | ||
1163 | |||
1164 | //act | ||
1165 | spyOn(focaModalService, 'modal').and.returnValue(promesaRespuesta); | ||
1166 | spyOn(scope, 'abrirModalCotizacion'); | ||
1167 | scope.seleccionarMoneda(); | ||
1168 | |||
1169 | //assert | ||
1170 | promesaRespuesta.then(function() { | ||
1171 | expect(scope.abrirModalCotizacion).toHaveBeenCalledWith('test'); | ||
1172 | done(); | ||
1173 | }); | ||
1174 | }); | ||
1175 | |||
1176 | it('función seleccionarObservaciones llama a prompt', function() { | ||
1177 | |||
1178 | //arrange | ||
1179 | var scope = {}; | ||
1180 | var focaModalService = { | ||
1181 | prompt: function() { } | ||
1182 | }; | ||
1183 | |||
1184 | $controler('notaPedidoCtrl', { | ||
1185 | $scope: scope, | ||
1186 | $uibModal: {}, | ||
1187 | $location: {}, | ||
1188 | $filter: filter, | ||
1189 | $timeout: timeout, | ||
1190 | crearNotaPedidoService: { | ||
1191 | getBotonera: function() { }, | ||
1192 | getCotizacionByIdMoneda: function() { | ||
1193 | return { | ||
1194 | then: function() { } | ||
1195 | }; | ||
1196 | } | ||
1197 | }, | ||
1198 | focaBotoneraLateralService: {}, | ||
1199 | focaModalService: focaModalService, | ||
1200 | notaPedidoBusinessService: {}, | ||
1201 | $rootScope: { | ||
1202 | $on: function() { } | ||
1203 | }, | ||
1204 | focaSeguimientoService: {}, | ||
1205 | APP: {}, | ||
1206 | focaLoginService: {} | ||
1207 | }); | ||
1208 | var respuesta = { then: function() { } }; | ||
1209 | scope.notaPedido = {}; | ||
1210 | |||
1211 | //act | ||
1212 | spyOn(focaModalService, 'prompt').and.returnValue(respuesta); | ||
1213 | scope.seleccionarObservaciones(); | ||
1214 | |||
1215 | //assert | ||
1216 | expect(focaModalService.prompt).toHaveBeenCalled(); | ||
1217 | }); | ||
1218 | |||
1219 | it('función seleccionarObservaciones setea observaciones', function(done) { | ||
1220 | |||
1221 | //arrange | ||
1222 | var scope = {}; | ||
1223 | var focaModalService = { | ||
1224 | prompt: function() { } | ||
1225 | }; | ||
1226 | |||
1227 | $controler('notaPedidoCtrl', { | ||
1228 | $scope: scope, | ||
1229 | $uibModal: {}, | ||
1230 | $location: {}, | ||
1231 | $filter: filter, | ||
1232 | $timeout: timeout, | ||
1233 | crearNotaPedidoService: { | ||
1234 | getBotonera: function() { }, | ||
1235 | getCotizacionByIdMoneda: function() { | ||
1236 | return { | ||
1237 | then: function() { } | ||
1238 | }; | ||
1239 | } | ||
1240 | }, | ||
1241 | focaBotoneraLateralService: {}, | ||
1242 | focaModalService: focaModalService, | ||
1243 | notaPedidoBusinessService: {}, | ||
1244 | $rootScope: { | ||
1245 | $on: function() { } | ||
1246 | }, | ||
1247 | focaSeguimientoService: {}, | ||
1248 | APP: {}, | ||
1249 | focaLoginService: {} | ||
1250 | }); | ||
1251 | var respuesta = 'unit test'; | ||
1252 | var promesa = Promise.resolve(respuesta); | ||
1253 | scope.notaPedido = {}; | ||
1254 | |||
1255 | //act | ||
1256 | spyOn(focaModalService, 'prompt').and.returnValue(promesa); | ||
1257 | scope.seleccionarObservaciones(); | ||
1258 | |||
1259 | //assert | ||
1260 | promesa.then(function() { | ||
1261 | expect(scope.notaPedido.observaciones).toEqual(respuesta); | ||
1262 | done(); | ||
1263 | }); | ||
1264 | }); | ||
1265 | |||
1266 | it('función abrirModalCotizacion abre modal', function() { | ||
1267 | |||
1268 | //arrange | ||
1269 | var scope = {}; | ||
1270 | var uibModal = { | ||
1271 | open: function() { } | ||
1272 | }; | ||
1273 | |||
1274 | $controler('notaPedidoCtrl', { | ||
1275 | $scope: scope, | ||
1276 | $uibModal: uibModal, | ||
1277 | $location: {}, | ||
1278 | $filter: filter, | ||
1279 | $timeout: timeout, | ||
1280 | crearNotaPedidoService: { | ||
1281 | getBotonera: function() { }, | ||
1282 | getCotizacionByIdMoneda: function() { | ||
1283 | return { | ||
1284 | then: function() { } | ||
1285 | }; | ||
1286 | } | ||
1287 | }, | ||
1288 | focaBotoneraLateralService: {}, | ||
1289 | focaModalService: {}, | ||
1290 | notaPedidoBusinessService: {}, | ||
1291 | $rootScope: { | ||
1292 | $on: function() { } | ||
1293 | }, | ||
1294 | focaSeguimientoService: {}, | ||
1295 | APP: {}, | ||
1296 | focaLoginService: {} | ||
1297 | }); | ||
1298 | |||
1299 | scope.notaPedido = {}; | ||
1300 | |||
1301 | var respuesta = { result: {then: function() { } } }; | ||
1302 | |||
1303 | //act | ||
1304 | spyOn(uibModal, 'open').and.returnValue(respuesta); | ||
1305 | scope.abrirModalCotizacion(); | ||
1306 | |||
1307 | //assert | ||
1308 | expect(uibModal.open).toHaveBeenCalled(); | ||
1309 | }); | ||
1310 | |||
1311 | it('función abrirModalCotizacion setea datos y cabecera', function(done) { | ||
1312 | //arrange | ||
1313 | var scope = {}; | ||
1314 | var uibModal = { | ||
1315 | open: function() { } | ||
1316 | }; | ||
1317 | |||
1318 | $controler('notaPedidoCtrl', { | ||
1319 | $scope: scope, | ||
1320 | $uibModal: uibModal, | ||
1321 | $location: {}, | ||
1322 | $filter: filter, | ||
1323 | $timeout: timeout, | ||
1324 | crearNotaPedidoService: { | ||
1325 | getBotonera: function() { }, | ||
1326 | getCotizacionByIdMoneda: function() { | ||
1327 | return { | ||
1328 | then: function() { } | ||
1329 | }; | ||
1330 | } | ||
1331 | }, | ||
1332 | focaBotoneraLateralService: {}, | ||
1333 | focaModalService: {}, | ||
1334 | notaPedidoBusinessService: {}, | ||
1335 | $rootScope: { | ||
1336 | $on: function() { } | ||
1337 | }, | ||
1338 | focaSeguimientoService: {}, | ||
1339 | APP: {}, | ||
1340 | focaLoginService: {} | ||
1341 | }); | ||
1342 | |||
1343 | scope.notaPedido = {}; | ||
1344 | scope.articulosTabla = []; | ||
1345 | scope.$broadcast = function() { }; | ||
1346 | var moneda = 'moneda'; | ||
1347 | var cotizacion = 'test'; | ||
1348 | var promesaRespuesta = { result: Promise.resolve(cotizacion) }; | ||
1349 | |||
1350 | //act | ||
1351 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); | ||
1352 | spyOn(scope, '$broadcast'); | ||
1353 | scope.abrirModalCotizacion(moneda); | ||
1354 | |||
1355 | //assert | ||
1356 | promesaRespuesta.result.then(function() { | ||
1357 | |||
1358 | expect(scope.$broadcast).toHaveBeenCalled(); | ||
1359 | expect(scope.notaPedido.moneda).toEqual(moneda); | ||
1360 | expect(scope.monedaDefecto).toEqual(moneda); | ||
1361 | expect(scope.cotizacionDefecto).toEqual(cotizacion); | ||
1362 | expect(scope.notaPedido.cotizacion).toEqual(cotizacion); | ||
1363 | done(); | ||
1364 | }); | ||
1365 | }); | ||
1366 | |||
1367 | it('función agregarATabla muestra alerta cuando a cargar undefined', function() { | ||
1368 | |||
1369 | //arrange | ||
1370 | var scope = {}; | ||
1371 | var focaModalService = { | ||
1372 | alert: function() { } | ||
1373 | }; | ||
1374 | |||
1375 | $controler('notaPedidoCtrl', { | ||
1376 | $scope: scope, | ||
1377 | $uibModal: {}, | ||
1378 | $location: {}, | ||
1379 | $filter: filter, | ||
1380 | $timeout: timeout, | ||
1381 | crearNotaPedidoService: { | ||
1382 | getBotonera: function() { }, | ||
1383 | getCotizacionByIdMoneda: function() { | ||
1384 | return { | ||
1385 | then: function() { } | ||
1386 | }; | ||
1387 | } | ||
1388 | }, | ||
1389 | focaBotoneraLateralService: {}, | ||
1390 | focaModalService: focaModalService, | ||
1391 | notaPedidoBusinessService: {}, | ||
1392 | $rootScope: { | ||
1393 | $on: function() { } | ||
1394 | }, | ||
1395 | focaSeguimientoService: {}, | ||
1396 | APP: {}, | ||
1397 | focaLoginService: {} | ||
1398 | }); | ||
1399 | scope.articuloACargar = {}; | ||
1400 | |||
1401 | //act | ||
1402 | spyOn(focaModalService, 'alert'); | ||
1403 | scope.agregarATabla(13); | ||
1404 | |||
1405 | //assert | ||
1406 | expect(focaModalService.alert).toHaveBeenCalledWith('El valor debe ser al menos 1'); | ||
1407 | }); | ||
1408 | |||
1409 | it('función editarArticulo muestra alerta cuando a cargar es undefined', function() { | ||
1410 | |||
1411 | //arrange | ||
1412 | var scope = {}; | ||
1413 | var focaModalService = { | ||
1414 | alert: function() { } | ||
1415 | }; | ||
1416 | |||
1417 | $controler('notaPedidoCtrl', { | ||
1418 | $scope: scope, | ||
1419 | $uibModal: {}, | ||
1420 | $location: {}, | ||
1421 | $filter: filter, | ||
1422 | $timeout: timeout, | ||
1423 | crearNotaPedidoService: { | ||
1424 | getBotonera: function() { }, | ||
1425 | getCotizacionByIdMoneda: function() { | ||
1426 | return { | ||
1427 | then: function() { } | ||
1428 | }; | ||
1429 | } | ||
1430 | }, | ||
1431 | focaBotoneraLateralService: {}, | ||
1432 | focaModalService: focaModalService, | ||
1433 | notaPedidoBusinessService: {}, | ||
1434 | $rootScope: { | ||
1435 | $on: function() { } | ||
1436 | }, | ||
1437 | focaSeguimientoService: {}, | ||
1438 | APP: {}, | ||
1439 | focaLoginService: {} | ||
1440 | }); | ||
1441 | scope.articuloACargar = {}; | ||
1442 | |||
1443 | //act | ||
1444 | spyOn(focaModalService, 'alert'); | ||
1445 | scope.agregarATabla(13); | ||
1446 | |||
1447 | //assert | ||
1448 | expect(focaModalService.alert).toHaveBeenCalledWith('El valor debe ser al menos 1'); | ||
1449 | }); | ||
1450 | |||
1451 | it('función salir lleva a ruta correcta', function() { | ||
1452 | |||
1453 | inject(function($location) { | ||
1454 | |||
1455 | //arrange | ||
1456 | var scope = {}; | ||
1457 | |||
1458 | $controler('notaPedidoCtrl', { | ||
1459 | $scope: scope, | ||
1460 | $uibModal: {}, | ||
1461 | $location: $location, | ||
1462 | $filter: filter, | ||
1463 | $timeout: timeout, | ||
1464 | crearNotaPedidoService: { | ||
1465 | getBotonera: function() { }, | ||
1466 | getCotizacionByIdMoneda: function() { | ||
1467 | return { | ||
1468 | then: function() { } | ||
1469 | }; | ||
1470 | } | ||
1471 | }, | ||
1472 | focaBotoneraLateralService: {}, | ||
1473 | focaModalService: {}, | ||
1474 | notaPedidoBusinessService: {}, | ||
1475 | $rootScope: { | ||
1476 | $on: function() { } | ||
1477 | }, | ||
1478 | focaSeguimientoService: {}, | ||
1479 | APP: {}, | ||
1480 | focaLoginService: {} | ||
1481 | }); | ||
1482 | |||
1483 | //act | ||
1484 | scope.salir(); | ||
1485 | |||
1486 | //assert | ||
1487 | expect($location.url()).toEqual('/'); | ||
1488 | }); | ||
1489 | }); | ||
1490 | }); | ||
1491 | }); | ||
1492 |
spec/controllerSpecCrearPedido.js
File was created | 1 | describe('Controladores módulo crear nota de pedido', function() { | |
2 | |||
3 | var $controler; | ||
4 | |||
5 | beforeEach(function() { | ||
6 | module('focaCrearNotaPedido'); | ||
7 | inject(function(_$controller_) { | ||
8 | $controler = _$controller_; | ||
9 | }); | ||
10 | }); | ||
11 | |||
12 | describe('Controlador notaPedidoCtrl crear nota de pedido', function() { | ||
13 | |||
14 | var filter = function() { | ||
15 | return function() { }; | ||
16 | }; | ||
17 | var timeout; | ||
18 | |||
19 | beforeEach(function() { | ||
20 | |||
21 | inject(function($timeout) { | ||
22 | timeout = $timeout; | ||
23 | }); | ||
24 | }); | ||
25 | |||
26 | it('Existe el controlador notaPedidoCtrl', function() { | ||
27 | |||
28 | //act | ||
29 | var controlador = $controler('notaPedidoCtrl', { | ||
30 | $scope: {}, | ||
31 | $uibModal: {}, | ||
32 | $location: {}, | ||
33 | $filter: filter, | ||
34 | $timeout: timeout, | ||
35 | crearNotaPedidoService: { | ||
36 | getBotonera: function() { }, | ||
37 | getCotizacionByIdMoneda: function() { | ||
38 | return { | ||
39 | then: function() {} | ||
40 | }; | ||
41 | } | ||
42 | }, | ||
43 | focaBotoneraLateralService: {}, | ||
44 | focaModalService: {}, | ||
45 | notaPedidoBusinessService: {}, | ||
46 | $rootScope: { | ||
47 | $on: function() { } | ||
48 | }, | ||
49 | focaSeguimientoService: {}, | ||
50 | APP: {}, | ||
51 | focaLoginService: {} | ||
52 | }); | ||
53 | |||
54 | //expect | ||
55 | expect(typeof controlador).toEqual('object'); | ||
56 | }); | ||
57 | |||
58 | it('la funcion $scope.crearNotaPedido muestra alerta cuando vendedor es null', function() { | ||
59 | |||
60 | //arrange | ||
61 | var scope = {}; | ||
62 | var focaModalService = { | ||
63 | alert: function() { } | ||
64 | }; | ||
65 | |||
66 | $controler('notaPedidoCtrl', { | ||
67 | $scope: scope, | ||
68 | $uibModal: {}, | ||
69 | $location: {}, | ||
70 | $filter: filter, | ||
71 | $timeout: timeout, | ||
72 | crearNotaPedidoService: { | ||
73 | getBotonera: function() { }, | ||
74 | getCotizacionByIdMoneda: function() { | ||
75 | return { | ||
76 | then: function() {} | ||
77 | }; | ||
78 | } | ||
79 | }, | ||
80 | focaBotoneraLateralService: {}, | ||
81 | focaModalService: focaModalService, | ||
82 | notaPedidoBusinessService: {}, | ||
83 | $rootScope: { | ||
84 | $on: function() { } | ||
85 | }, | ||
86 | focaSeguimientoService: {}, | ||
87 | APP: {}, | ||
88 | focaLoginService: {} | ||
89 | }); | ||
90 | |||
91 | //act | ||
92 | scope.notaPedido = { | ||
93 | vendedor: { | ||
94 | id: null | ||
95 | } | ||
96 | }; | ||
97 | spyOn(focaModalService, 'alert'); | ||
98 | scope.crearNotaPedido(); | ||
99 | |||
100 | //expect | ||
101 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Vendedor'); | ||
102 | }); | ||
103 | |||
104 | it('la funcion $scope.crearNotaPedido muestra alerta cuando cliente es null', function() { | ||
105 | |||
106 | //arrange | ||
107 | var scope = {}; | ||
108 | var focaModalService = { | ||
109 | alert: function() { } | ||
110 | }; | ||
111 | |||
112 | $controler('notaPedidoCtrl', { | ||
113 | $scope: scope, | ||
114 | $uibModal: {}, | ||
115 | $location: {}, | ||
116 | $filter: filter, | ||
117 | $timeout: timeout, | ||
118 | crearNotaPedidoService: { | ||
119 | getBotonera: function() { }, | ||
120 | getCotizacionByIdMoneda: function() { | ||
121 | return { | ||
122 | then: function() {} | ||
123 | }; | ||
124 | } | ||
125 | }, | ||
126 | focaBotoneraLateralService: {}, | ||
127 | focaModalService: focaModalService, | ||
128 | notaPedidoBusinessService: {}, | ||
129 | $rootScope: { | ||
130 | $on: function() { } | ||
131 | }, | ||
132 | focaSeguimientoService: {}, | ||
133 | APP: {}, | ||
134 | focaLoginService: {} | ||
135 | }); | ||
136 | |||
137 | scope.notaPedido = { | ||
138 | vendedor: { | ||
139 | id: true | ||
140 | }, | ||
141 | cliente:{ | ||
142 | COD: false | ||
143 | } | ||
144 | }; | ||
145 | |||
146 | //act | ||
147 | spyOn(focaModalService, 'alert'); | ||
148 | scope.crearNotaPedido(); | ||
149 | |||
150 | //expect | ||
151 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cliente'); | ||
152 | }); | ||
153 | |||
154 | it('funcion $scope.crearNotaPedido muestra alerta cuando proveedor es null', function() { | ||
155 | |||
156 | //arrange | ||
157 | var scope = {}; | ||
158 | var focaModalService = { | ||
159 | alert: function() { } | ||
160 | }; | ||
161 | |||
162 | $controler('notaPedidoCtrl', { | ||
163 | $scope: scope, | ||
164 | $uibModal: {}, | ||
165 | $location: {}, | ||
166 | $filter: filter, | ||
167 | $timeout: timeout, | ||
168 | crearNotaPedidoService: { | ||
169 | getBotonera: function() { }, | ||
170 | getCotizacionByIdMoneda: function() { | ||
171 | return { | ||
172 | then: function() {} | ||
173 | }; | ||
174 | } | ||
175 | }, | ||
176 | focaBotoneraLateralService: {}, | ||
177 | focaModalService: focaModalService, | ||
178 | notaPedidoBusinessService: {}, | ||
179 | $rootScope: { | ||
180 | $on: function() { } | ||
181 | }, | ||
182 | focaSeguimientoService: {}, | ||
183 | APP: {}, | ||
184 | focaLoginService: {} | ||
185 | }); | ||
186 | |||
187 | scope.notaPedido = { | ||
188 | vendedor: { | ||
189 | id: true | ||
190 | }, | ||
191 | cliente:{ | ||
192 | COD: true | ||
193 | }, | ||
194 | proveedor:{ | ||
195 | COD: null | ||
196 | } | ||
197 | }; | ||
198 | |||
199 | //act | ||
200 | spyOn(focaModalService, 'alert'); | ||
201 | scope.crearNotaPedido(); | ||
202 | |||
203 | //expect | ||
204 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Proveedor'); | ||
205 | }); | ||
206 | |||
207 | it('funcion $scope.crearNotaPedido muestra alerta cuando Moneda es null', function() { | ||
208 | |||
209 | //arrange | ||
210 | var scope = {}; | ||
211 | var focaModalService = { | ||
212 | alert: function() { } | ||
213 | }; | ||
214 | |||
215 | $controler('notaPedidoCtrl', { | ||
216 | $scope: scope, | ||
217 | $uibModal: {}, | ||
218 | $location: {}, | ||
219 | $filter: filter, | ||
220 | $timeout: timeout, | ||
221 | crearNotaPedidoService: { | ||
222 | getBotonera: function() { }, | ||
223 | getCotizacionByIdMoneda: function() { | ||
224 | return { | ||
225 | then: function() {} | ||
226 | }; | ||
227 | } | ||
228 | }, | ||
229 | focaBotoneraLateralService: {}, | ||
230 | focaModalService: focaModalService, | ||
231 | notaPedidoBusinessService: {}, | ||
232 | $rootScope: { | ||
233 | $on: function() { } | ||
234 | }, | ||
235 | focaSeguimientoService: {}, | ||
236 | APP: {}, | ||
237 | focaLoginService: {} | ||
238 | }); | ||
239 | |||
240 | scope.notaPedido = { | ||
241 | vendedor: { | ||
242 | id: true | ||
243 | }, | ||
244 | cliente:{ | ||
245 | COD: true | ||
246 | }, | ||
247 | proveedor:{ | ||
248 | COD: true | ||
249 | }, | ||
250 | moneda:{ | ||
251 | ID: null | ||
252 | } | ||
253 | }; | ||
254 | |||
255 | //act | ||
256 | spyOn(focaModalService, 'alert'); | ||
257 | scope.crearNotaPedido(); | ||
258 | |||
259 | //expect | ||
260 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Moneda'); | ||
261 | }); | ||
262 | |||
263 | it('funcion $scope.crearNotaPedido muestra alerta cuando cotizacion es null', function() { | ||
264 | |||
265 | //arrange | ||
266 | var scope = {}; | ||
267 | var focaModalService = { | ||
268 | alert: function() { } | ||
269 | }; | ||
270 | |||
271 | $controler('notaPedidoCtrl', { | ||
272 | $scope: scope, | ||
273 | $uibModal: {}, | ||
274 | $location: {}, | ||
275 | $filter: filter, | ||
276 | $timeout: timeout, | ||
277 | crearNotaPedidoService: { | ||
278 | getBotonera: function() { }, | ||
279 | getCotizacionByIdMoneda: function() { | ||
280 | return { | ||
281 | then: function() {} | ||
282 | }; | ||
283 | } | ||
284 | }, | ||
285 | focaBotoneraLateralService: {}, | ||
286 | focaModalService: focaModalService, | ||
287 | notaPedidoBusinessService: {}, | ||
288 | $rootScope: { | ||
289 | $on: function() { } | ||
290 | }, | ||
291 | focaSeguimientoService: {}, | ||
292 | APP: {}, | ||
293 | focaLoginService: {} | ||
294 | }); | ||
295 | |||
296 | scope.notaPedido = { | ||
297 | vendedor: { | ||
298 | id: true | ||
299 | }, | ||
300 | cliente:{ | ||
301 | COD: true | ||
302 | }, | ||
303 | proveedor:{ | ||
304 | COD: true | ||
305 | }, | ||
306 | moneda:{ | ||
307 | ID: true | ||
308 | }, | ||
309 | cotizacion:{ | ||
310 | ID: null | ||
311 | } | ||
312 | }; | ||
313 | |||
314 | //act | ||
315 | spyOn(focaModalService, 'alert'); | ||
316 | scope.crearNotaPedido(); | ||
317 | |||
318 | //expect | ||
319 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cotización'); | ||
320 | }); | ||
321 | |||
322 | it('funcion $scope.crearNotaPedido muestra alerta cuando plazos es null', function() { | ||
323 | |||
324 | //arrange | ||
325 | var scope = {}; | ||
326 | var focaModalService = { | ||
327 | alert: function() { } | ||
328 | }; | ||
329 | |||
330 | $controler('notaPedidoCtrl', { | ||
331 | $scope: scope, | ||
332 | $uibModal: {}, | ||
333 | $location: {}, | ||
334 | $filter: filter, | ||
335 | $timeout: timeout, | ||
336 | crearNotaPedidoService: { | ||
337 | getBotonera: function() { }, | ||
338 | getCotizacionByIdMoneda: function() { | ||
339 | return { | ||
340 | then: function() {} | ||
341 | }; | ||
342 | } | ||
343 | }, | ||
344 | focaBotoneraLateralService: {}, | ||
345 | focaModalService: focaModalService, | ||
346 | notaPedidoBusinessService: {}, | ||
347 | $rootScope: { | ||
348 | $on: function() { } | ||
349 | }, | ||
350 | focaSeguimientoService: {}, | ||
351 | APP: {}, | ||
352 | focaLoginService: {} | ||
353 | }); | ||
354 | |||
355 | scope.notaPedido = { | ||
356 | vendedor: { | ||
357 | id: true | ||
358 | }, | ||
359 | cliente:{ | ||
360 | COD: true | ||
361 | }, | ||
362 | proveedor:{ | ||
363 | COD: true | ||
364 | }, | ||
365 | moneda:{ | ||
366 | ID: true | ||
367 | }, | ||
368 | cotizacion:{ | ||
369 | ID: true | ||
370 | } | ||
371 | }; | ||
372 | |||
373 | scope.plazosPagos = null; | ||
374 | |||
375 | //act | ||
376 | spyOn(focaModalService, 'alert'); | ||
377 | scope.crearNotaPedido(); | ||
378 | |||
379 | //expect | ||
380 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Precios y Condiciones'); | ||
381 | }); | ||
382 | |||
383 | it('funcion $scope.crearNotaPedido muestra alerta cuando flete es null', function() { | ||
384 | |||
385 | //arrange | ||
386 | var scope = {}; | ||
387 | var focaModalService = { | ||
388 | alert: function() { } | ||
389 | }; | ||
390 | |||
391 | $controler('notaPedidoCtrl', { | ||
392 | $scope: scope, | ||
393 | $uibModal: {}, | ||
394 | $location: {}, | ||
395 | $filter: filter, | ||
396 | $timeout: timeout, | ||
397 | crearNotaPedidoService: { | ||
398 | getBotonera: function() { }, | ||
399 | getCotizacionByIdMoneda: function() { | ||
400 | return { | ||
401 | then: function() {} | ||
402 | }; | ||
403 | } | ||
404 | }, | ||
405 | focaBotoneraLateralService: {}, | ||
406 | focaModalService: focaModalService, | ||
407 | notaPedidoBusinessService: {}, | ||
408 | $rootScope: { | ||
409 | $on: function() { } | ||
410 | }, | ||
411 | focaSeguimientoService: {}, | ||
412 | APP: {}, | ||
413 | focaLoginService: {} | ||
414 | }); | ||
415 | |||
416 | scope.notaPedido = { | ||
417 | vendedor: { | ||
418 | id: true | ||
419 | }, | ||
420 | cliente:{ | ||
421 | COD: true | ||
422 | }, | ||
423 | proveedor:{ | ||
424 | COD: true | ||
425 | }, | ||
426 | moneda:{ | ||
427 | ID: true | ||
428 | }, | ||
429 | cotizacion:{ | ||
430 | ID: true | ||
431 | }, | ||
432 | flete: null | ||
433 | }; | ||
434 | |||
435 | scope.plazosPagos = true; | ||
436 | |||
437 | //act | ||
438 | spyOn(focaModalService, 'alert'); | ||
439 | scope.crearNotaPedido(); | ||
440 | |||
441 | //expect | ||
442 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Flete'); | ||
443 | }); | ||
444 | |||
445 | it('funcion $scope.crearNotaPedido muestra alerta cuando domicilio es null', function() { | ||
446 | |||
447 | //arrange | ||
448 | var scope = {}; | ||
449 | var focaModalService = { | ||
450 | alert: function() { } | ||
451 | }; | ||
452 | |||
453 | $controler('notaPedidoCtrl', { | ||
454 | $scope: scope, | ||
455 | $uibModal: {}, | ||
456 | $location: {}, | ||
457 | $filter: filter, | ||
458 | $timeout: timeout, | ||
459 | crearNotaPedidoService: { | ||
460 | getBotonera: function() { }, | ||
461 | getCotizacionByIdMoneda: function() { | ||
462 | return { | ||
463 | then: function() {} | ||
464 | }; | ||
465 | } | ||
466 | }, | ||
467 | focaBotoneraLateralService: {}, | ||
468 | focaModalService: focaModalService, | ||
469 | notaPedidoBusinessService: {}, | ||
470 | $rootScope: { | ||
471 | $on: function() { } | ||
472 | }, | ||
473 | focaSeguimientoService: {}, | ||
474 | APP: {}, | ||
475 | focaLoginService: {} | ||
476 | }); | ||
477 | |||
478 | scope.notaPedido = { | ||
479 | vendedor: { | ||
480 | id: true | ||
481 | }, | ||
482 | cliente:{ | ||
483 | COD: true | ||
484 | }, | ||
485 | proveedor:{ | ||
486 | COD: true | ||
487 | }, | ||
488 | moneda:{ | ||
489 | ID: true | ||
490 | }, | ||
491 | cotizacion:{ | ||
492 | ID: true | ||
493 | }, | ||
494 | flete: true, | ||
495 | domicilioStamp: null | ||
496 | }; | ||
497 | |||
498 | scope.plazosPagos = true; | ||
499 | |||
500 | //act | ||
501 | spyOn(focaModalService, 'alert'); | ||
502 | scope.crearNotaPedido(); | ||
503 | |||
504 | //expect | ||
505 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Domicilio'); | ||
506 | }); | ||
507 | |||
508 | it('funcion $scope.crearNotaPedido muestra alerta cuando no se cargaron articulos', | ||
509 | function() | ||
510 | { | ||
511 | |||
512 | //arrange | ||
513 | var scope = {}; | ||
514 | var focaModalService = { | ||
515 | alert: function() { } | ||
516 | }; | ||
517 | |||
518 | $controler('notaPedidoCtrl', { | ||
519 | $scope: scope, | ||
520 | $uibModal: {}, | ||
521 | $location: {}, | ||
522 | $filter: filter, | ||
523 | $timeout: timeout, | ||
524 | crearNotaPedidoService: { | ||
525 | getBotonera: function() { }, | ||
526 | getCotizacionByIdMoneda: function() { | ||
527 | return { | ||
528 | then: function() {} | ||
529 | }; | ||
530 | } | ||
531 | }, | ||
532 | focaBotoneraLateralService: {}, | ||
533 | focaModalService: focaModalService, | ||
534 | notaPedidoBusinessService: {}, | ||
535 | $rootScope: { | ||
536 | $on: function() { } | ||
537 | }, | ||
538 | focaSeguimientoService: {}, | ||
539 | APP: {}, | ||
540 | focaLoginService: {} | ||
541 | }); | ||
542 | |||
543 | scope.notaPedido = { | ||
544 | vendedor: { | ||
545 | id: true | ||
546 | }, | ||
547 | cliente:{ | ||
548 | COD: true | ||
549 | }, | ||
550 | proveedor:{ | ||
551 | COD: true | ||
552 | }, | ||
553 | moneda:{ | ||
554 | ID: true | ||
555 | }, | ||
556 | cotizacion:{ | ||
557 | ID: true | ||
558 | }, | ||
559 | flete: true, | ||
560 | domicilioStamp: true, | ||
561 | }; | ||
562 | |||
563 | scope.plazosPagos = true; | ||
564 | scope.articulosTabla = []; | ||
565 | |||
566 | //act | ||
567 | spyOn(focaModalService, 'alert'); | ||
568 | scope.crearNotaPedido(); | ||
569 | |||
570 | //expect | ||
571 | expect(focaModalService.alert) | ||
572 | .toHaveBeenCalledWith('Debe cargar al menos un articulo'); | ||
573 | }); | ||
574 | |||
575 | it('funcion $scope.crearNotaPedido llama startGuardar', function() { | ||
576 | |||
577 | //arrange | ||
578 | var scope = {}; | ||
579 | var focaBotoneraLateralService = { | ||
580 | startGuardar: function() { } | ||
581 | }; | ||
582 | |||
583 | $controler('notaPedidoCtrl', { | ||
584 | $scope: scope, | ||
585 | $uibModal: {}, | ||
586 | $location: {}, | ||
587 | $filter: filter, | ||
588 | $timeout: timeout, | ||
589 | crearNotaPedidoService: { | ||
590 | getBotonera: function() { }, | ||
591 | getCotizacionByIdMoneda: function() { | ||
592 | return { | ||
593 | then: function() {} | ||
594 | }; | ||
595 | }, | ||
596 | crearNotaPedido: function() { | ||
597 | return { | ||
598 | then: function() { } | ||
599 | }; | ||
600 | } | ||
601 | }, | ||
602 | focaBotoneraLateralService: focaBotoneraLateralService, | ||
603 | focaModalService: {}, | ||
604 | notaPedidoBusinessService: {}, | ||
605 | $rootScope: { | ||
606 | $on: function() { } | ||
607 | }, | ||
608 | focaSeguimientoService: {}, | ||
609 | APP: {}, | ||
610 | focaLoginService: {} | ||
611 | }); | ||
612 | |||
613 | scope.notaPedido = { | ||
614 | vendedor: { | ||
615 | id: true | ||
616 | }, | ||
617 | cliente:{ | ||
618 | COD: true | ||
619 | }, | ||
620 | proveedor:{ | ||
621 | COD: true | ||
622 | }, | ||
623 | moneda:{ | ||
624 | ID: true | ||
625 | }, | ||
626 | cotizacion:{ | ||
627 | ID: true | ||
628 | }, | ||
629 | flete: true, | ||
630 | domicilioStamp: true, | ||
631 | domicilio: { | ||
632 | id: true | ||
633 | } | ||
634 | }; | ||
635 | |||
636 | scope.plazosPagos = true; | ||
637 | scope.articulosTabla = [1]; | ||
638 | |||
639 | //act | ||
640 | spyOn(focaBotoneraLateralService, 'startGuardar'); | ||
641 | scope.crearNotaPedido(); | ||
642 | |||
643 | //expect | ||
644 | expect(focaBotoneraLateralService.startGuardar).toHaveBeenCalled(); | ||
645 | }); | ||
646 | |||
647 | it('funcion $scope.crearNotaPedido llama funciones al guardar', function(done) { | ||
648 | |||
649 | //arrange | ||
650 | var scope = {}; | ||
651 | var focaBotoneraLateralService = { | ||
652 | startGuardar: function() { }, | ||
653 | endGuardar: function() { } | ||
654 | }; | ||
655 | var focaSeguimientoService = { | ||
656 | guardarPosicion: function() { } | ||
657 | }; | ||
658 | var notaPedidoBusinessService = { | ||
659 | addArticulos: function() { }, | ||
660 | addEstado: function() { } | ||
661 | }; | ||
662 | var crearNotaPedidoService = { | ||
663 | getBotonera: function() { }, | ||
664 | getCotizacionByIdMoneda: function() { | ||
665 | return { | ||
666 | then: function() {} | ||
667 | }; | ||
668 | }, | ||
669 | crearNotaPedido: function() { }, | ||
670 | getNumeroNotaPedido: function() { | ||
671 | return { | ||
672 | then: function() { } | ||
673 | }; | ||
674 | } | ||
675 | }; | ||
676 | |||
677 | $controler('notaPedidoCtrl', { | ||
678 | $scope: scope, | ||
679 | $uibModal: {}, | ||
680 | $location: {}, | ||
681 | $filter: filter, | ||
682 | $timeout: timeout, | ||
683 | crearNotaPedidoService: crearNotaPedidoService, | ||
684 | focaBotoneraLateralService: focaBotoneraLateralService, | ||
685 | focaModalService: {}, | ||
686 | notaPedidoBusinessService: notaPedidoBusinessService, | ||
687 | $rootScope: { | ||
688 | $on: function() { } | ||
689 | }, | ||
690 | focaSeguimientoService: focaSeguimientoService, | ||
691 | APP: {}, | ||
692 | focaLoginService: {} | ||
693 | }); | ||
694 | |||
695 | scope.notaPedido = { | ||
696 | vendedor: { | ||
697 | id: true | ||
698 | }, | ||
699 | cliente:{ | ||
700 | COD: true | ||
701 | }, | ||
702 | proveedor:{ | ||
703 | COD: true | ||
704 | }, | ||
705 | moneda:{ | ||
706 | ID: true | ||
707 | }, | ||
708 | cotizacion:{ | ||
709 | ID: true | ||
710 | }, | ||
711 | flete: true, | ||
712 | domicilioStamp: true, | ||
713 | domicilio: { | ||
714 | id: true | ||
715 | } | ||
716 | }; | ||
717 | |||
718 | scope.plazosPagos = []; | ||
719 | scope.articulosTabla = [1]; | ||
720 | |||
721 | var promesa = Promise.resolve({ data: 1 }); | ||
722 | scope.$broadcast = function() { }; | ||
723 | |||
724 | //act | ||
725 | spyOn(crearNotaPedidoService, 'crearNotaPedido').and.returnValue(promesa); | ||
726 | spyOn(focaSeguimientoService, 'guardarPosicion'); | ||
727 | spyOn(notaPedidoBusinessService, 'addArticulos'); | ||
728 | scope.crearNotaPedido(); | ||
729 | |||
730 | //expect | ||
731 | promesa.then(function() { | ||
732 | expect(focaSeguimientoService.guardarPosicion).toHaveBeenCalled(); | ||
733 | expect(notaPedidoBusinessService.addArticulos).toHaveBeenCalled(); | ||
734 | done(); | ||
735 | }); | ||
736 | }); | ||
737 | }); | ||
738 | }); |
src/js/service.js
1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .factory('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | var route = API_ENDPOINT.URL; | 3 | var route = API_ENDPOINT.URL; |
4 | return { | 4 | return { |
5 | crearNotaPedido: function(notaPedido) { | 5 | crearNotaPedido: function(notaPedido) { |
6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | 6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); |
7 | }, | 7 | }, |
8 | obtenerNotaPedido: function() { | 8 | obtenerNotaPedido: function() { |
9 | return $http.get(route +'/nota-pedido'); | 9 | return $http.get(route +'/nota-pedido'); |
10 | }, | 10 | }, |
11 | setNotaPedido: function(notaPedido) { | 11 | setNotaPedido: function(notaPedido) { |
12 | this.notaPedido = notaPedido; | 12 | this.notaPedido = notaPedido; |
13 | }, | 13 | }, |
14 | clearNotaPedido: function() { | 14 | clearNotaPedido: function() { |
15 | this.notaPedido = undefined; | 15 | this.notaPedido = undefined; |
16 | }, | 16 | }, |
17 | getNotaPedido: function() { | 17 | getNotaPedido: function() { |
18 | return this.notaPedido; | 18 | return this.notaPedido; |
19 | }, | 19 | }, |
20 | getArticulosByIdNotaPedido: function(id) { | 20 | getArticulosByIdNotaPedido: function(id) { |
21 | return $http.get(route+'/articulos/nota-pedido/'+id); | 21 | return $http.get(route+'/articulos/nota-pedido/'+id); |
22 | }, | 22 | }, |
23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { | 23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { |
24 | return $http.post(route + '/articulos/nota-pedido', | 24 | return $http.post(route + '/articulos/nota-pedido', |
25 | {articuloNotaPedido: articuloNotaPedido}); | 25 | {articuloNotaPedido: articuloNotaPedido}); |
26 | }, | 26 | }, |
27 | getDomiciliosByIdNotaPedido: function(id) { | 27 | getDomiciliosByIdNotaPedido: function(id) { |
28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
29 | }, | 29 | }, |
30 | getDomiciliosByIdCliente: function(id) { | 30 | getDomiciliosByIdCliente: function(id) { |
31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
33 | }, | 33 | }, |
34 | getPrecioCondicion: function() { | 34 | getPrecioCondicion: function() { |
35 | return $http.get(route + '/precio-condicion'); | 35 | return $http.get(route + '/precio-condicion'); |
36 | }, | 36 | }, |
37 | getPrecioCondicionById: function(id) { | 37 | getPrecioCondicionById: function(id) { |
38 | return $http.get(route + '/precio-condicion/' + id); | 38 | return $http.get(route + '/precio-condicion/' + id); |
39 | }, | 39 | }, |
40 | getPlazoPagoByPrecioCondicion: function(id) { | 40 | getPlazoPagoByPrecioCondicion: function(id) { |
41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
42 | }, | 42 | }, |
43 | crearFlete: function(flete) { | 43 | crearFlete: function(flete) { |
44 | return $http.post(route + '/flete', {flete : flete}); | 44 | return $http.post(route + '/flete', {flete : flete}); |
45 | }, | 45 | }, |
46 | crearPlazosParaNotaPedido: function(plazos) { | 46 | crearPlazosParaNotaPedido: function(plazos) { |
47 | return $http.post(route + '/plazo-pago/nota-pedido', {plazos: plazos}); | 47 | return $http.post(route + '/plazo-pago/nota-pedido', {plazos: plazos}); |
48 | }, | 48 | }, |
49 | getCotizacionByIdMoneda: function(id) { | 49 | getCotizacionByIdMoneda: function(id) { |
50 | return $http.get(route + '/moneda/' + id); | 50 | return $http.get(route + '/moneda/' + id); |
51 | }, | 51 | }, |
52 | crearEstadoParaNotaPedido: function(estado) { | 52 | crearEstadoParaNotaPedido: function(estado) { |
53 | return $http.post(route + '/estado', {estado: estado}); | 53 | return $http.post(route + '/estado', {estado: estado}); |
54 | }, | 54 | }, |
55 | getNumeroNotaPedido: function() { | 55 | getNumeroNotaPedido: function() { |
56 | return $http.get(route + '/nota-pedido/numero-siguiente'); | 56 | return $http.get(route + '/nota-pedido/numero-siguiente'); |
57 | }, | 57 | }, |
58 | getBotonera: function(vendedor) { | 58 | getBotonera: function(vendedor) { |
59 | var result = [ | 59 | var result = [ |
60 | { | 60 | { |
61 | label: 'Cliente', | 61 | label: 'Cliente', |
62 | image: 'cliente.png' | 62 | image: 'cliente.png' |
63 | }, | 63 | }, |
64 | { | 64 | { |
65 | label: 'Proveedor', | 65 | label: 'Proveedor', |
66 | image: 'proveedor.png' | 66 | image: 'proveedor.png' |
67 | }, | 67 | }, |
68 | { | 68 | { |
69 | label: 'Moneda', | 69 | label: 'Moneda', |
70 | image: 'moneda.png' | 70 | image: 'moneda.png' |
71 | }, | 71 | }, |
72 | { | 72 | { |
73 | label: 'Precios y condiciones', | 73 | label: 'Precios y condiciones', |
74 | image: 'precios-condiciones.png' | 74 | image: 'precios-condiciones.png' |
75 | }, | 75 | }, |
76 | { | 76 | { |
77 | label: 'Flete', | 77 | label: 'Flete', |
78 | image: 'flete.png' | 78 | image: 'flete.png' |
79 | }, | 79 | }, |
80 | { | 80 | { |
81 | label: 'Productos', | 81 | label: 'Productos', |
82 | image: 'productos.png' | 82 | image: 'productos.png' |
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | label: 'Observaciones', | 85 | label: 'Observaciones', |
86 | image: 'productos.png' | 86 | image: 'productos.png' |
87 | } | 87 | } |
88 | ]; | 88 | ]; |
89 | 89 | ||
90 | if(!vendedor) { | 90 | if(!vendedor) { |
91 | var botonVendedor = { | 91 | var botonVendedor = { |
92 | label: 'Vendedor', | 92 | label: 'Vendedor', |
93 | image: 'vendedor.png' | 93 | image: 'vendedor.png' |
94 | }; | 94 | }; |
95 | 95 | ||
96 | result.unshift(botonVendedor); | 96 | result.unshift(botonVendedor); |
97 | } | 97 | } |
98 | 98 | ||
99 | return result; | 99 | return result; |
100 | }, | 100 | }, |
101 | crearPuntosDescarga: function(puntosDescarga) { | 101 | crearPuntosDescarga: function(puntosDescarga) { |
102 | return $http.post(route + '/puntos-descarga/nota-pedido', | 102 | return $http.post(route + '/puntos-descarga/nota-pedido', |
103 | {puntosDescarga: puntosDescarga}); | 103 | {puntosDescarga: puntosDescarga}); |
104 | }, | 104 | }, |
105 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 105 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { |
106 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 106 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + |
107 | idDomicilio + '/' + idCliente); | 107 | idDomicilio + '/' + idCliente); |
108 | }, | 108 | }, |
109 | getVendedorById: function(id) { | 109 | getVendedorById: function(id) { |
110 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); | 110 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); |
111 | } | 111 | } |
112 | }; | 112 | }; |
113 | }]); | 113 | }]); |
114 | 114 |
test.html
1 | <html> | 1 | <html> |
2 | <head> | 2 | <head> |
3 | <link rel="stylesheet" type="text/css" href="node_modules/jasmine-core/lib/jasmine-core/jasmine.css"> | 3 | <link rel="stylesheet" type="text/css" href="node_modules/jasmine-core/lib/jasmine-core/jasmine.css"> |
4 | <meta charset="UTF-8" /> | 4 | <meta charset="UTF-8" /> |
5 | </head> | 5 | </head> |
6 | <body> | 6 | <body> |
7 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script> | 7 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script> |
8 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script> | 8 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script> |
9 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/boot.js"></script> | 9 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/boot.js"></script> |
10 | <script type="text/javascript" src="node_modules/angular/angular.min.js"></script> | 10 | <script type="text/javascript" src="node_modules/angular/angular.min.js"></script> |
11 | <script type="text/javascript" src="node_modules/angular-route/angular-route.min.js"></script> | 11 | <script type="text/javascript" src="node_modules/angular-route/angular-route.min.js"></script> |
12 | <script type="text/javascript" src="node_modules/angular-mocks/angular-mocks.js"></script> | 12 | <script type="text/javascript" src="node_modules/angular-mocks/angular-mocks.js"></script> |
13 | <script type="text/javascript" src="src/js/app.js"></script> | 13 | <script type="text/javascript" src="src/js/app.js"></script> |
14 | <script type="text/javascript" src="src/js/controller.js"></script> | 14 | <script type="text/javascript" src="src/js/controller.js"></script> |
15 | <script type="text/javascript" src="src/js/service.js"></script> | 15 | <script type="text/javascript" src="src/js/service.js"></script> |
16 | <script type="text/javascript" src="src/js/route.js"></script> | 16 | <script type="text/javascript" src="src/js/route.js"></script> |
17 | <script type="text/javascript" src="spec/controllerSpec.js"></script> | 17 | <script type="text/javascript" src="spec/controllerSpec.js"></script> |
18 | <script type="text/javascript" src="spec/controllerSpecCrearPedido.js"></script> | ||
18 | <script type="text/javascript" src="spec/serviceSpec.js"></script> | 19 | <script type="text/javascript" src="spec/serviceSpec.js"></script> |
19 | <script type="text/javascript" src="spec/routeSpec.js"></script> | 20 | <script type="text/javascript" src="spec/routeSpec.js"></script> |
20 | </body> | 21 | </body> |
21 | </html> | 22 | </html> |
22 | 23 |