1
0

Porting golang yelp wrapper to v3-fusion-api

This commit is contained in:
2018-03-28 00:06:15 +02:00
parent 2be94f4c7b
commit c4f8b16a01
14 changed files with 891 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
package yelp
import (
"testing"
"github.com/guregu/null"
)
// TestLocationOptions will check using location options by term.
func TestLocationOptions(t *testing.T) {
client := getClient(t)
options := SearchOptions{
GeneralOptions: &GeneralOptions{
Term: "coffee",
},
LocationOptions: &LocationOptions{
Location: "seattle",
},
}
result, err := client.DoSearch(options)
check(t, err)
assert(t, len(result.Businesses) > 0, containsResults)
}
// TestLocationWithCoordinates will check using location options with bounding coordinates.
func TestLocationWithCoordinates(t *testing.T) {
client := getClient(t)
options := SearchOptions{
GeneralOptions: &GeneralOptions{
Term: "food",
},
LocationOptions: &LocationOptions{
"bellevue",
&CoordinateOptions{
Latitude: null.FloatFrom(37.788022),
Longitude: null.FloatFrom(-122.399797),
},
},
}
result, err := client.DoSearch(options)
check(t, err)
assert(t, len(result.Businesses) > 0, containsResults)
}