-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaystore_test.go
More file actions
51 lines (39 loc) · 876 Bytes
/
playstore_test.go
File metadata and controls
51 lines (39 loc) · 876 Bytes
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
package appcrawl
import (
"strings"
"testing"
)
func TestPlayStore(t *testing.T) {
s := PlayStore{}
req := SearchRequest{
Query: "facebook",
Country: "US",
Limit: 2,
}
apps, err := s.Search(req)
if err != nil {
t.Error(err)
}
t.Log(apps)
if len(apps) != req.Limit {
t.Error("Did not get correct number of results from app store")
}
if apps[0].Package != "com.facebook.katana" {
t.Error("Facebook app package does not match")
}
if !strings.Contains(apps[0].PublisherName, "Facebook") {
t.Error("Facebook not publisher")
}
if !strings.Contains(apps[0].Name, "Facebook") {
t.Error("Facebook not in app name")
}
if len(apps[0].StoreUrl) == 0 {
t.Error("Missing store URL")
}
if len(apps[0].IconUrl) == 0 {
t.Error("Missing icon URL")
}
if apps[0].Rating <= 0 || apps[0].Rating > 5.0 {
t.Error("Invalid app rating")
}
}