11'use strict' ;
22
3- import lib from '../lib' ;
43import { expect } from 'chai' ;
4+ import redis from 'redis' ;
5+ import rg from '../lib' ;
56
67describe ( 'simple-reverse-geocoder' , ( ) => {
8+ before ( ( ) => {
9+ const client = redis . createClient ( ) ;
10+ rg . setCache ( client ) ;
11+ } ) ;
12+
713 describe ( 'getAddress' , ( ) => {
814 it ( 'should return a valid address' , ( done ) => {
915 const loc = { type : 'Point' , coordinates : [ - 70.5171743 , - 33.3608387 ] } ;
10- lib . setCache ( ) ;
11- lib . getAddress ( loc ) . then ( data => {
16+ rg . getAddress ( loc ) . then ( data => {
1217 expect ( data ) . to . eql ( 'Del Candil 665-701, Lo Barnechea' ) ;
1318 done ( ) ;
1419 } ) . catch ( err => {
@@ -17,8 +22,8 @@ describe('simple-reverse-geocoder', () => {
1722 } ) ;
1823 } ) ;
1924
20- it ( 'should return a valid address' , ( done ) => {
21- lib . getFromCache ( - 33.3608387 , - 70.5171743 ) . then ( reply => {
25+ it ( 'should return a valid address from cache ' , ( done ) => {
26+ rg . getFromCache ( - 33.3608387 , - 70.5171743 ) . then ( reply => {
2227 expect ( reply ) . to . eql ( 'Del Candil 665-701, Lo Barnechea' ) ;
2328 done ( ) ;
2429 } ) . catch ( err => {
@@ -29,6 +34,6 @@ describe('simple-reverse-geocoder', () => {
2934 } ) ;
3035
3136 after ( ( ) => {
32- lib . clearCache ( - 33.3608387 , - 70.5171743 ) ;
37+ rg . clearCache ( - 33.3608387 , - 70.5171743 ) ;
3338 } ) ;
3439} ) ;
0 commit comments