-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapfit_test.go
52 lines (43 loc) · 981 Bytes
/
mapfit_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package mapfit_test
import (
"fmt"
"os"
"testing"
mapfit "github.com/albttx/go-mapfit"
)
var (
MapfitToken = os.Getenv("MAPFIT_TOKEN")
)
func init() {
if MapfitToken == "" {
fmt.Println("Environment variable missing: MAPFIT_TOKEN")
os.Exit(1)
}
}
func TestMapfitDirections(t *testing.T) {
mapfitClient := mapfit.NewClient(MapfitToken)
srcAddr := mapfit.Address{
StreetAddress: "avenue des Champs Elysee",
Locality: "Paris",
}
dstAddr := mapfit.Address{
StreetAddress: "Tour Eiffel",
Locality: "Paris",
}
// _, err := mapfitClient.GetDirections(srcAddr, dstAddr, "driving")
_, err := mapfitClient.GetDirections(srcAddr, dstAddr, "walking")
if err != nil {
t.Fatal(err)
}
}
func TestMapfitGeocode(t *testing.T) {
mapfitClient := mapfit.NewClient(MapfitToken)
addr := mapfit.Address{
StreetAddress: "avenue des Champs Elysee",
Locality: "Paris",
}
_, err := mapfitClient.Geocode(addr)
if err != nil {
t.Fatal(err)
}
}