-
Notifications
You must be signed in to change notification settings - Fork 2
/
restaurant_test.go
56 lines (44 loc) · 1006 Bytes
/
restaurant_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
53
54
55
56
package zomato_test
import (
"context"
"testing"
"github.com/go-india/zomato"
)
func TestDailyMenu(t *testing.T) {
c := zomato.NewClient(getAPIKey())
testClient(&c, t)
resp, err := c.DailyMenu(context.Background(), 16514301)
if err != nil {
t.Fatalf("DailyMenu failed: %+v", err)
}
if resp.DailyMenus == nil {
t.Fatal("invalid response length")
}
}
func TestRestaurant(t *testing.T) {
c := zomato.NewClient(getAPIKey())
testClient(&c, t)
resp, err := c.Restaurant(context.Background(), 463)
if err != nil {
t.Fatalf("Restaurant failed: %+v", err)
}
if resp.ID == nil {
t.Fatal("invalid response length")
}
}
func TestReviews(t *testing.T) {
c := zomato.NewClient(getAPIKey())
testClient(&c, t)
req := zomato.ReviewsReq{
RestaurantID: 463,
Start: 1,
Count: 100,
}
resp, err := c.Reviews(context.Background(), req)
if err != nil {
t.Fatalf("Reviews failed: %+v", err)
}
if resp.UserReviews == nil {
t.Fatal("invalid response length")
}
}