1
1
'use strict' ;
2
2
3
- import lib from '../lib' ;
4
3
import { expect } from 'chai' ;
4
+ import redis from 'redis' ;
5
+ import rg from '../lib' ;
5
6
6
7
describe ( 'simple-reverse-geocoder' , ( ) => {
8
+ before ( ( ) => {
9
+ const client = redis . createClient ( ) ;
10
+ rg . setCache ( client ) ;
11
+ } ) ;
12
+
7
13
describe ( 'getAddress' , ( ) => {
8
14
it ( 'should return a valid address' , ( done ) => {
9
15
const loc = { type : 'Point' , coordinates : [ - 70.5171743 , - 33.3608387 ] } ;
10
- lib . setCache ( ) ;
11
- lib . getAddress ( loc ) . then ( data => {
16
+ rg . getAddress ( loc ) . then ( data => {
12
17
expect ( data ) . to . eql ( 'Del Candil 665-701, Lo Barnechea' ) ;
13
18
done ( ) ;
14
19
} ) . catch ( err => {
@@ -17,8 +22,8 @@ describe('simple-reverse-geocoder', () => {
17
22
} ) ;
18
23
} ) ;
19
24
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 => {
22
27
expect ( reply ) . to . eql ( 'Del Candil 665-701, Lo Barnechea' ) ;
23
28
done ( ) ;
24
29
} ) . catch ( err => {
@@ -29,6 +34,6 @@ describe('simple-reverse-geocoder', () => {
29
34
} ) ;
30
35
31
36
after ( ( ) => {
32
- lib . clearCache ( - 33.3608387 , - 70.5171743 ) ;
37
+ rg . clearCache ( - 33.3608387 , - 70.5171743 ) ;
33
38
} ) ;
34
39
} ) ;
0 commit comments