-
Notifications
You must be signed in to change notification settings - Fork 1
/
board_test.go
69 lines (56 loc) · 1.5 KB
/
board_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
59
60
61
62
63
64
65
66
67
68
69
package ginside
import (
"context"
"net/http"
"strconv"
"testing"
"time"
)
func TestBoardRecommendedPosts(t *testing.T) {
g := NewGInside(&http.Client{
Timeout: 1 * time.Minute,
})
posts, err := g.BoardPosts(context.Background(), "pledis", true)
if err != nil {
t.Fatal("BoardPosts returned an error: " + err.Error())
}
if len(posts) < 10 {
t.Fatal("BoardPosts returned too few posts: ", strconv.Itoa(len(posts)))
}
}
func TestBoardMinorRecommendedPosts(t *testing.T) {
g := NewGInside(&http.Client{
Timeout: 1 * time.Minute,
})
posts, err := g.BoardMinorPosts(context.Background(), "sis", true)
if err != nil {
t.Fatal("BoardMinorPosts returned an error: " + err.Error())
}
if len(posts) < 10 {
t.Fatal("BoardMinorPosts returned too few posts: ", strconv.Itoa(len(posts)))
}
}
func TestBoardAllPosts(t *testing.T) {
g := NewGInside(&http.Client{
Timeout: 1 * time.Minute,
})
posts, err := g.BoardPosts(context.Background(), "pledis", false)
if err != nil {
t.Fatal("BoardPosts returned an error: " + err.Error())
}
if len(posts) < 10 {
t.Fatal("BoardPosts returned too few posts: ", strconv.Itoa(len(posts)))
}
}
func TestBoardMinorAllPosts(t *testing.T) {
g := NewGInside(&http.Client{
Timeout: 1 * time.Minute,
})
posts, err := g.BoardMinorPosts(context.Background(), "sis", false)
if err != nil {
t.Fatal("BoardMinorPosts returned an error: " + err.Error())
}
if len(posts) < 10 {
t.Fatal("BoardMinorPosts returned too few posts: ", strconv.Itoa(len(posts)))
}
}