-
Notifications
You must be signed in to change notification settings - Fork 0
/
devrant_test.go
49 lines (39 loc) · 1.02 KB
/
devrant_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
package devgorant_test
import (
"testing"
"github.com/jayeshsolanki93/devgorant"
)
func TestProfile_jayeshs(t *testing.T) {
devrant := devgorant.New()
user, _, err := devrant.Profile("jayeshs")
if err != nil {
t.Fatalf(`err != nil, got %v`, err)
}
if got, want := user.Username, "jayeshs"; got != want {
t.Errorf(`user.Username = %s, want %s`, got, want)
}
if got, want := user.CreatedTime, 1463402493; got != want {
t.Errorf(`user.CreatedTime = %d, want %d`, got, want)
}
}
func TestRant_27317(t *testing.T) {
devrant := devgorant.New()
rant, _, err := devrant.Rant(27317)
if err != nil {
t.Fatalf(`err != nil, got %v`, err)
}
if got, want := rant.UserId, 27292; got != want {
t.Errorf(`rant.UserId = %d, want %d`, got, want)
}
}
func TestRants(t *testing.T) {
devrant := devgorant.New()
rants, err := devrant.Rants("algo", 50, 0)
if err != nil {
t.Fatalf(`err != nil, got %v`, err)
}
if got, want := len(rants), 50; got != want {
t.Errorf(`len(rants) = %d, want > 0`, got)
}
}
// TODO: More tests