Commit fbb7b361f72dcf2b2606e2e209e855d3c770d8b1

Authored by Eric Fernandez
1 parent 3813aec2f8
Exists in master and in 2 other branches develop, lab

prueba pre-commit

Showing 2 changed files with 2 additions and 2 deletions   Show diff stats
1 const templateCache = require('gulp-angular-templatecache'); 1 const templateCache = require('gulp-angular-templatecache');
2 const concat = require('gulp-concat'); 2 const concat = require('gulp-concat');
3 const htmlmin = require('gulp-htmlmin'); 3 const htmlmin = require('gulp-htmlmin');
4 const rename = require('gulp-rename'); 4 const rename = require('gulp-rename');
5 const uglify = require('gulp-uglify-es').default; 5 const uglify = require('gulp-uglify-es').default;
6 const gulp = require('gulp'); 6 const gulp = require('gulp');
7 const pump = require('pump'); 7 const pump = require('pump');
8 const jshint = require('gulp-jshint'); 8 const jshint = require('gulp-jshint');
9 const replace = require('gulp-replace'); 9 const replace = require('gulp-replace');
10 const connect = require('gulp-connect'); 10 const connect = require('gulp-connect');
11 const clean = require('gulp-clean'); 11 const clean = require('gulp-clean');
12 const header = require('gulp-header'); 12 const header = require('gulp-header');
13 const footer =require('gulp-footer'); 13 const footer =require('gulp-footer');
14 14
15 var paths = { 15 var paths = {
16 srcJS: 'src/js/*.js', 16 srcJS: 'src/js/*.js',
17 srcViews: 'src/views/*.html', 17 srcViews: 'src/views/*.html',
18 specs: 'spec/*.js', 18 specs: 'spec/*.js',
19 tmp: 'tmp', 19 tmp: 'tmp',
20 dist: 'dist/' 20 dist: 'dist/'
21 }; 21 };
22 22
23 gulp.task('templates', function() { 23 gulp.task('templates', function() {
24 return pump( 24 return pump(
25 [ 25 [
26 gulp.src(paths.srcViews), 26 gulp.src(paths.srcViews),
27 replace('views/', ''), 27 replace('views/', ''),
28 htmlmin(), 28 htmlmin(),
29 templateCache('views.js', { 29 templateCache('views.js', {
30 module: 'focaAbmChofer', 30 module: 'focaAbmChofer',
31 root: '' 31 root: ''
32 }), 32 }),
33 gulp.dest(paths.tmp) 33 gulp.dest(paths.tmp)
34 ] 34 ]
35 ); 35 );
36 }); 36 });
37 37
38 gulp.task('uglify', ['templates', 'uglify-spec'], function() { 38 gulp.task('uglify', ['templates', 'uglify-spec'], function() {
39 return pump( 39 return pump(
40 [ 40 [
41 gulp.src([ 41 gulp.src([
42 paths.srcJS, 42 paths.srcJS,
43 'tmp/views.js' 43 'tmp/views.js'
44 ]), 44 ]),
45 concat('foca-abm-chofer.js'), 45 concat('foca-abm-chofer.js'),
46 replace("src/views/", ''), 46 replace("src/views/", ''),
47 gulp.dest(paths.tmp), 47 gulp.dest(paths.tmp),
48 rename('foca-abm-chofer.min.js'), 48 rename('foca-abm-chofer.min.js'),
49 uglify(), 49 uglify(),
50 gulp.dest(paths.dist) 50 gulp.dest(paths.dist)
51 ] 51 ]
52 ); 52 );
53 }); 53 });
54 54
55 gulp.task('uglify-spec', function() { 55 gulp.task('uglify-spec', function() {
56 return pump([ 56 return pump([
57 gulp.src(paths.specs), 57 gulp.src(paths.specs),
58 concat('foca-abm-chofer.spec.js'), 58 concat('foca-abm-chofer.spec.js'),
59 replace("src/views/", ''), 59 replace("src/views/", ''),
60 header("describe('Módulo foca-abm-chofer', function() { \n"), 60 header("describe('Módulo foca-abm-chofer', function() { \n"),
61 footer("});"), 61 footer("});"),
62 gulp.dest(paths.dist) 62 gulp.dest(paths.dist)
63 ]); 63 ]);
64 }); 64 });
65 65
66 gulp.task('clean', function() { 66 gulp.task('clean', function() {
67 return gulp.src(['tmp', 'dist'], {read: false}) 67 return gulp.src(['tmp', 'dist'], {read: false})
68 .pipe(clean()); 68 .pipe(clean());
69 }); 69 });
70 70
71 gulp.task('pre-commit', function() { 71 gulp.task('pre-commit', function() {
72 pump( 72 return pump(
73 [ 73 [
74 gulp.src([paths.srcJS, paths.specs]), 74 gulp.src([paths.srcJS, paths.specs]),
75 jshint('.jshintrc'), 75 jshint('.jshintrc'),
76 jshint.reporter('default'), 76 jshint.reporter('default'),
77 jshint.reporter('fail') 77 jshint.reporter('fail')
78 ] 78 ]
79 ); 79 );
80 80
81 gulp.start('uglify'); 81 gulp.start('uglify');
82 }); 82 });
83 83
84 gulp.task('clean-post-install', function() { 84 gulp.task('clean-post-install', function() {
85 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 85 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
86 'index.html', 'spec', 'test.html'], {read: false}) 86 'index.html', 'spec', 'test.html'], {read: false})
87 .pipe(clean()); 87 .pipe(clean());
88 }); 88 });
89 89
90 gulp.task('compile', ['templates', 'uglify']); 90 gulp.task('compile', ['templates', 'uglify']);
91 91
92 gulp.task('watch', function() { 92 gulp.task('watch', function() {
93 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); 93 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
94 }); 94 });
95 95
96 gulp.task('webserver', function() { 96 gulp.task('webserver', function() {
97 pump [ 97 pump [
98 connect.server({port: 3000}) 98 connect.server({port: 3000})
99 ] 99 ]
100 }); 100 });
101 101
102 gulp.task('default', ['webserver']); 102 gulp.task('default', ['webserver']);
103 103
1 describe('Servicios de foca abm chofer', function() { 1 describe('Servicios de foca abm chofer', function() {
2 2
3 var httpBackend; 3 var httpBackend;
4 var servicio; 4 var servicio;
5 5
6 beforeEach(function() { 6 beforeEach(function() {
7 module('focaAbmChofer'); 7 module('focaAbmChofer');
8 inject(module(function($provide) { 8 inject(module(function($provide) {
9 $provide.value('API_ENDPOINT', { 9 $provide.value('API_ENDPOINT', {
10 URL: 'localhost' 10 URL: 'localhost'
11 }); 11 });
12 })); 12 }));
13 inject(function($httpBackend, _focaAbmChoferService_) { 13 inject(function($httpBackend, _focaAbmChoferService_) {
14 servicio = _focaAbmChoferService_; 14 servicio = _focaAbmChoferService_;
15 httpBackend = $httpBackend; 15 httpBackend = $httpBackend;
16 }); 16 });
17 }); 17 });
18 18
19 describe('Servicio focaAbmChoferService', function() { 19 describe('Servicio focaAbmChoferService', function() {
20 it('Existe el servicio', function() { 20 it('Existe el servicio', function() {
21 //assert 21 //assert
22 expect(typeof servicio).toEqual('object'); 22 expect(typeof servicio).toEqual('object');
23 }); 23 });
24 24
25 it('La función getChoferes lleva a la ruta correcta', function() { 25 it('La función getChoferes lleva a la ruta correcta', function() {
26 //arrange 26 //arrange
27 var returnFake = 'test'; 27 var returnFake = 'test';
28 var result; 28 var result;
29 httpBackend.expectGET('localhost/chofer').respond(returnFake); 29 httpBackend.expectGET('localhost/chofer').respond(returnFake);
30 30
31 //act 31 //act
32 servicio.getChoferes().then(function(data) { 32 servicio.getChoferes().then(function(data) {
33 result = data.data; 33 result = data.data;
34 }); 34 });
35 httpBackend.flush(); 35 httpBackend.flush();
36 36
37 expect(result).toEqual(returnFake); 37 expect(result).toEqual(returnFake);
38 }); 38 });
39 39
40 it('La función getChofer lleva a la ruta correcta', function() { 40 it('La función getChofer lleva a la ruta correcta', function() {
41 //arrange 41 //arrange
42 var returnFake = 'test'; 42 var returnFake = 'test';
43 var paramFake = 1; 43 var paramFake = 1;
44 var result; 44 var result;
45 httpBackend.expectGET('localhost/chofer/' + paramFake).respond(returnFake); 45 httpBackend.expectGET('localhost/chofer/' + paramFake).respond(returnFake);
46 46
47 //act 47 //act
48 servicio.getChofer(paramFake).then(function(data) { 48 servicio.getChofer(paramFake).then(function(data) {
49 result = data.data; 49 result = data.data;
50 }); 50 });
51 httpBackend.flush(); 51 httpBackend.flush();
52 52
53 expect(result).toEqual(returnFake); 53 expect(result).toEqual(returnFake);
54 }) 54 });
55 55
56 it('La función getChoferPorTransportista lleva a la ruta correcta', function() { 56 it('La función getChoferPorTransportista lleva a la ruta correcta', function() {
57 //arrange 57 //arrange
58 var returnFake = 'test'; 58 var returnFake = 'test';
59 var paramFake = 1; 59 var paramFake = 1;
60 var result; 60 var result;
61 httpBackend.expectGET('localhost/chofer/transportista/' + paramFake) 61 httpBackend.expectGET('localhost/chofer/transportista/' + paramFake)
62 .respond(returnFake); 62 .respond(returnFake);
63 63
64 //act 64 //act
65 servicio.getChoferPorTransportista(paramFake).then(function(data) { 65 servicio.getChoferPorTransportista(paramFake).then(function(data) {
66 result = data.data; 66 result = data.data;
67 }); 67 });
68 httpBackend.flush(); 68 httpBackend.flush();
69 69
70 expect(result).toEqual(returnFake); 70 expect(result).toEqual(returnFake);
71 }); 71 });
72 72
73 it('La función getChoferPorDni lleva a la ruta correcta', function() { 73 it('La función getChoferPorDni lleva a la ruta correcta', function() {
74 //arrange 74 //arrange
75 var returnFake = 'test'; 75 var returnFake = 'test';
76 var paramFake = 1; 76 var paramFake = 1;
77 var result; 77 var result;
78 httpBackend.expectPOST('localhost/chofer/dni', { dni: paramFake }) 78 httpBackend.expectPOST('localhost/chofer/dni', { dni: paramFake })
79 .respond(returnFake); 79 .respond(returnFake);
80 80
81 //act 81 //act
82 servicio.getChoferPorDni(paramFake).then(function(data) { 82 servicio.getChoferPorDni(paramFake).then(function(data) {
83 result = data.data; 83 result = data.data;
84 }); 84 });
85 httpBackend.flush(); 85 httpBackend.flush();
86 86
87 //assert 87 //assert
88 expect(result).toEqual(returnFake); 88 expect(result).toEqual(returnFake);
89 }); 89 });
90 90
91 it('La función guardarChofer llama a la ruta correcta', function() { 91 it('La función guardarChofer llama a la ruta correcta', function() {
92 //arrange 92 //arrange
93 var returnFake = 'test'; 93 var returnFake = 'test';
94 var paramFake = 1; 94 var paramFake = 1;
95 var result; 95 var result;
96 httpBackend.expectPOST('localhost/chofer', { chofer: paramFake }) 96 httpBackend.expectPOST('localhost/chofer', { chofer: paramFake })
97 .respond(returnFake); 97 .respond(returnFake);
98 98
99 //act 99 //act
100 servicio.guardarChofer(paramFake).then(function(data) { 100 servicio.guardarChofer(paramFake).then(function(data) {
101 result = data.data; 101 result = data.data;
102 }); 102 });
103 httpBackend.flush(); 103 httpBackend.flush();
104 104
105 //assert 105 //assert
106 expect(result).toEqual(returnFake); 106 expect(result).toEqual(returnFake);
107 }); 107 });
108 108
109 it('La función getTransportistas lleva a la ruta correcta', function() { 109 it('La función getTransportistas lleva a la ruta correcta', function() {
110 //arrange 110 //arrange
111 var returnFake = 'test'; 111 var returnFake = 'test';
112 var result; 112 var result;
113 httpBackend.expectGET('localhost/transportista').respond(returnFake); 113 httpBackend.expectGET('localhost/transportista').respond(returnFake);
114 114
115 //act 115 //act
116 servicio.getTransportistas().then(function(data) { 116 servicio.getTransportistas().then(function(data) {
117 result = data.data; 117 result = data.data;
118 }); 118 });
119 httpBackend.flush(); 119 httpBackend.flush();
120 120
121 //assert 121 //assert
122 expect(result).toEqual(returnFake); 122 expect(result).toEqual(returnFake);
123 }); 123 });
124 124
125 it('La función getTransportistaPorId lleva a la ruta correcta', function() { 125 it('La función getTransportistaPorId lleva a la ruta correcta', function() {
126 //arrange 126 //arrange
127 var returnFake = 'test'; 127 var returnFake = 'test';
128 var paramFake = 1; 128 var paramFake = 1;
129 var result; 129 var result;
130 httpBackend.expectGET('localhost/transportista/' + paramFake).respond(returnFake); 130 httpBackend.expectGET('localhost/transportista/' + paramFake).respond(returnFake);
131 131
132 //act 132 //act
133 servicio.getTransportistaPorId(paramFake).then(function(data) { 133 servicio.getTransportistaPorId(paramFake).then(function(data) {
134 result = data.data; 134 result = data.data;
135 }); 135 });
136 httpBackend.flush(); 136 httpBackend.flush();
137 137
138 //assert 138 //assert
139 expect(result).toEqual(returnFake); 139 expect(result).toEqual(returnFake);
140 }); 140 });
141 141
142 it('La función deleteChofer lleva a la ruta correcta', function() { 142 it('La función deleteChofer lleva a la ruta correcta', function() {
143 //arrange 143 //arrange
144 var returnFake = 'test'; 144 var returnFake = 'test';
145 var paramFake = 1; 145 var paramFake = 1;
146 var result; 146 var result;
147 httpBackend.expectDELETE('localhost/chofer/' + paramFake).respond(returnFake); 147 httpBackend.expectDELETE('localhost/chofer/' + paramFake).respond(returnFake);
148 148
149 //act 149 //act
150 servicio.deleteChofer(paramFake).then(function(data) { 150 servicio.deleteChofer(paramFake).then(function(data) {
151 result = data.data; 151 result = data.data;
152 }); 152 });
153 httpBackend.flush(); 153 httpBackend.flush();
154 154
155 //assert 155 //assert
156 expect(result).toEqual(returnFake); 156 expect(result).toEqual(returnFake);
157 }); 157 });
158 158
159 it('La función getTiposDocumento lleva a la ruta correcta', function() { 159 it('La función getTiposDocumento lleva a la ruta correcta', function() {
160 //arrange 160 //arrange
161 var returnFake = 'test'; 161 var returnFake = 'test';
162 var result; 162 var result;
163 httpBackend.expectGET('localhost/tipo-documento').respond(returnFake); 163 httpBackend.expectGET('localhost/tipo-documento').respond(returnFake);
164 164
165 //act 165 //act
166 servicio.getTiposDocumento().then(function(data) { 166 servicio.getTiposDocumento().then(function(data) {
167 result = data.data; 167 result = data.data;
168 }); 168 });
169 httpBackend.flush(); 169 httpBackend.flush();
170 170
171 //assert 171 //assert
172 expect(result).toEqual(returnFake); 172 expect(result).toEqual(returnFake);
173 }); 173 });
174 }); 174 });
175 }); 175 });
176 176