-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseragent_test.go
58 lines (50 loc) · 1.24 KB
/
useragent_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
57
58
package commonuseragent
import (
"testing"
)
func TestGetAllDesktop(t *testing.T) {
desktops := GetAllDesktop()
if len(desktops) == 0 {
t.Errorf("GetAllDesktop returned an empty slice")
}
}
func TestGetAllMobile(t *testing.T) {
mobiles := GetAllMobile()
if len(mobiles) == 0 {
t.Errorf("GetAllMobile returned an empty slice")
}
}
func TestGetRandomDesktop(t *testing.T) {
// Calling the function to test
result := GetRandomDesktop()
if result.UA == "" {
t.Errorf("GetRandomDesktop returned an empty user agent")
}
}
func TestGetRandomDesktopUA(t *testing.T) {
// Calling the function to test
result := GetRandomDesktopUA()
if result == "" {
t.Errorf("GetRandomDesktop returned an empty user agent")
}
}
func TestGetRandomMobile(t *testing.T) {
// Calling the function to test
result := GetRandomMobile()
if result.UA == "" {
t.Errorf("GetRandomMobile returned an empty user agent")
}
}
func TestGetRandomMobileUA(t *testing.T) {
// Calling the function to test
result := GetRandomMobileUA()
if result == "" {
t.Errorf("GetRandomMobile returned an empty user agent")
}
}
func TestGetRandomUserAgent(t *testing.T) {
result := GetRandomUA()
if result == "" {
t.Errorf("GetRandomUserAgent returned an empty user agent")
}
}