@@ -29,9 +29,6 @@ describe('cep-promise (unit)', () => {
2929 nock ( 'https://viacep.com.br' )
3030 . get ( '/ws/05010000/json/' )
3131 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-05010000-found.json' ) )
32- nock ( 'http://www.cepaberto.com' )
33- . get ( '/api/v2/ceps.json?cep=05010000' )
34- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-05010000-found.json' ) )
3532
3633 const cepPromise = cep ( '05010000' )
3734 expect ( cepPromise . then ) . to . be . a ( 'function' )
@@ -124,9 +121,6 @@ describe('cep-promise (unit)', () => {
124121 nock ( 'https://viacep.com.br' )
125122 . get ( '/ws/05010000/json/' )
126123 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-05010000-found.json' ) )
127- nock ( 'http://www.cepaberto.com' )
128- . get ( '/api/v2/ceps.json?cep=05010000' )
129- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-05010000-found.json' ) )
130124
131125 return expect ( cep ( '05010000' ) ) . to . eventually . deep . equal ( {
132126 cep : '05010000' ,
@@ -146,9 +140,6 @@ describe('cep-promise (unit)', () => {
146140 nock ( 'https://viacep.com.br' )
147141 . get ( '/ws/05010000/json/' )
148142 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-05010000-found.json' ) )
149- nock ( 'http://www.cepaberto.com' )
150- . get ( '/api/v2/ceps.json?cep=05010000' )
151- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-05010000-found.json' ) )
152143
153144 return expect ( cep ( 5010000 ) ) . to . eventually . deep . equal ( {
154145 cep : '05010000' ,
@@ -168,9 +159,6 @@ describe('cep-promise (unit)', () => {
168159 nock ( 'https://viacep.com.br' )
169160 . get ( '/ws/05010000/json/' )
170161 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-99999999-error.json' ) )
171- nock ( 'http://www.cepaberto.com' )
172- . get ( '/api/v2/ceps.json?cep=05010000' )
173- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-99999999-error.json' ) )
174162
175163 return expect ( cep ( '5010000' ) ) . to . eventually . deep . equal ( {
176164 cep : '05010000' ,
@@ -190,32 +178,7 @@ describe('cep-promise (unit)', () => {
190178 nock ( 'https://viacep.com.br' )
191179 . get ( '/ws/05010000/json/' )
192180 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-05010000-found.json' ) )
193- nock ( 'http://www.cepaberto.com' )
194- . get ( '/api/v2/ceps.json?cep=05010000' )
195- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-99999999-error.json' ) )
196-
197- return expect ( cep ( '5010000' ) ) . to . eventually . deep . equal ( {
198- cep : '05010000' ,
199- state : 'SP' ,
200- city : 'São Paulo' ,
201- neighborhood : 'Perdizes' ,
202- street : 'Rua Caiubi'
203- } )
204- } )
205- } )
206181
207- describe ( 'Should succeed only with cep aberto service' , ( ) => {
208- it ( 'should fulfill with correct address' , ( ) => {
209- nock ( 'https://apps.correios.com.br' )
210- . post ( '/SigepMasterJPA/AtendeClienteService/AtendeCliente' )
211- . replyWithFile ( 500 , path . join ( __dirname , '/fixtures/response-unknown-format.xml' ) )
212- nock ( 'https://viacep.com.br' )
213- . get ( '/ws/05010000/json/' )
214- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-99999999-error.json' ) )
215- nock ( 'http://www.cepaberto.com' )
216- . get ( '/api/v2/ceps.json?cep=05010000' )
217- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-05010000-found.json' ) )
218-
219182 return expect ( cep ( '5010000' ) ) . to . eventually . deep . equal ( {
220183 cep : '05010000' ,
221184 state : 'SP' ,
@@ -234,9 +197,6 @@ describe('cep-promise (unit)', () => {
234197 nock ( 'https://viacep.com.br' )
235198 . get ( '/ws/05010000/json/' )
236199 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-05010000-found.json' ) )
237- nock ( 'http://www.cepaberto.com' )
238- . get ( '/api/v2/ceps.json?cep=05010000' )
239- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-05010000-found.json' ) )
240200
241201 return expect ( cep ( '5010000' ) ) . to . eventually . deep . equal ( {
242202 cep : '05010000' ,
@@ -256,9 +216,6 @@ describe('cep-promise (unit)', () => {
256216 nock ( 'https://viacep.com.br' )
257217 . get ( '/ws/05010000/json/' )
258218 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-05010000-found.json' ) )
259- nock ( 'http://www.cepaberto.com' )
260- . get ( '/api/v2/ceps.json?cep=05010000' )
261- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-05010000-found.json' ) )
262219
263220 return expect ( cep ( '5010000' ) ) . to . eventually . deep . equal ( {
264221 cep : '05010000' ,
@@ -278,9 +235,6 @@ describe('cep-promise (unit)', () => {
278235 nock ( 'https://viacep.com.br' )
279236 . get ( '/ws/99999999/json/' )
280237 . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/viacep-cep-99999999-error.json' ) )
281- nock ( 'http://www.cepaberto.com' )
282- . get ( '/api/v2/ceps.json?cep=99999999' )
283- . replyWithFile ( 200 , path . join ( __dirname , '/fixtures/cep-aberto-99999999-error.json' ) )
284238
285239 return cep ( '99999999' )
286240 . catch ( ( error ) => {
@@ -296,9 +250,6 @@ describe('cep-promise (unit)', () => {
296250 } , {
297251 message : 'CEP não encontrado na base do ViaCEP.' ,
298252 service : 'viacep'
299- } , {
300- message : 'CEP não encontrado na base do Cep Aberto.' ,
301- service : 'cepaberto'
302253 } ]
303254 } )
304255 } )
@@ -332,9 +283,6 @@ describe('cep-promise (unit)', () => {
332283 nock ( 'https://viacep.com.br' )
333284 . get ( '/ws/05010000/json/' )
334285 . reply ( 400 , '<h2>Bad Request (400)</h2>' )
335- nock ( 'http://www.cepaberto.com' )
336- . get ( '/api/v2/ceps.json?cep=05010000' )
337- . reply ( 400 , '<h2>Bad Request (400)</h2>' )
338286
339287 return cep ( '05010000' )
340288 . catch ( ( error ) => {
@@ -350,9 +298,6 @@ describe('cep-promise (unit)', () => {
350298 } , {
351299 message : 'Erro ao se conectar com o serviço ViaCEP.' ,
352300 service : 'viacep'
353- } , {
354- message : 'Erro ao se conectar com o serviço Cep Aberto.' ,
355- service : 'cepaberto'
356301 } ]
357302 } )
358303 } )
@@ -367,9 +312,6 @@ describe('cep-promise (unit)', () => {
367312 nock ( 'https://viacep.com.br' )
368313 . get ( '/ws/05010000/json/' )
369314 . reply ( 400 , '<h2>Bad Request (400)</h2>' )
370- nock ( 'http://www.cepaberto.com' )
371- . get ( '/api/v2/ceps.json?cep=05010000' )
372- . reply ( 400 , '<h2>Bad Request (400)</h2>' )
373315
374316 return cep ( '05010000' )
375317 . catch ( ( error ) => {
@@ -385,9 +327,6 @@ describe('cep-promise (unit)', () => {
385327 } , {
386328 message : 'Erro ao se conectar com o serviço ViaCEP.' ,
387329 service : 'viacep'
388- } , {
389- message : 'Erro ao se conectar com o serviço Cep Aberto.' ,
390- service : 'cepaberto'
391330 } ]
392331 } )
393332 } )
@@ -402,9 +341,6 @@ describe('cep-promise (unit)', () => {
402341 nock ( 'https://viacep.com.br' )
403342 . get ( '/ws/05010000/json/' )
404343 . replyWithError ( 'getaddrinfo ENOTFOUND apps.correios.com.br apps.correios.com.br:443' )
405- nock ( 'http://www.cepaberto.com' )
406- . get ( '/api/v2/ceps.json?cep=05010000' )
407- . replyWithError ( 'getaddrinfo ENOTFOUND apps.correios.com.br apps.correios.com.br:443' )
408344
409345 return cep ( '05010000' )
410346 . catch ( ( error ) => {
@@ -420,9 +356,6 @@ describe('cep-promise (unit)', () => {
420356 } , {
421357 message : 'Erro ao se conectar com o serviço ViaCEP.' ,
422358 service : 'viacep'
423- } , {
424- message : 'Erro ao se conectar com o serviço Cep Aberto.' ,
425- service : 'cepaberto'
426359 } ]
427360 } )
428361 } )
0 commit comments