1
1
package pickpoint_test
2
2
3
3
import (
4
+ "github.com/codingsince1985/geo-golang"
5
+ "github.com/codingsince1985/geo-golang/pickpoint"
6
+ "github.com/stretchr/testify/assert"
7
+ "net/http"
8
+ "net/http/httptest"
4
9
"os"
5
10
"strings"
6
11
"testing"
7
- "net/http"
8
- "net/http/httptest"
9
- "github.com/stretchr/testify/assert"
10
- "github.com/codingsince1985/geo-golang"
11
- "github.com/codingsince1985/geo-golang/pickpoint"
12
12
)
13
13
14
14
var key = os .Getenv ("PICKPOINT_API_KEY" )
@@ -17,7 +17,7 @@ func TestGeocode(t *testing.T) {
17
17
ts := testServer (response1 )
18
18
defer ts .Close ()
19
19
20
- geocoder := pickpoint .Geocoder (key , ts .URL + "/" )
20
+ geocoder := pickpoint .Geocoder (key , ts .URL + "/" )
21
21
location , err := geocoder .Geocode ("60 Collins St, Melbourne VIC 3000" )
22
22
assert .Nil (t , err )
23
23
assert .Equal (t , geo.Location {Lat : - 37.8157915 , Lng : 144.9656171 }, * location )
@@ -27,7 +27,7 @@ func TestReverseGeocode(t *testing.T) {
27
27
ts := testServer (response2 )
28
28
defer ts .Close ()
29
29
30
- geocoder := pickpoint .Geocoder (key , ts .URL + "/" )
30
+ geocoder := pickpoint .Geocoder (key , ts .URL + "/" )
31
31
address , err := geocoder .ReverseGeocode (- 37.8157915 , 144.9656171 )
32
32
assert .Nil (t , err )
33
33
assert .True (t , strings .Index (address .FormattedAddress , "Collins St" ) > 0 )
@@ -37,7 +37,7 @@ func TestReverseGeocodeWithNoResult(t *testing.T) {
37
37
ts := testServer (response3 )
38
38
defer ts .Close ()
39
39
40
- geocoder := pickpoint .Geocoder (key , ts .URL + "/" )
40
+ geocoder := pickpoint .Geocoder (key , ts .URL + "/" )
41
41
addr , err := geocoder .ReverseGeocode (- 37.8157915 , 164.9656171 )
42
42
assert .Nil (t , addr )
43
43
assert .NotNil (t , err )
0 commit comments