-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient_test.go
45 lines (42 loc) · 903 Bytes
/
client_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
package feedly
import (
"reflect"
"testing"
)
func TestClient_FetchFeed(t *testing.T) {
c := NewClient()
type args struct {
url string
}
tests := []struct {
name string
args args
wantCode uint32
wantRes []byte
wantErr RequestError
}{
{
name: "test1",
args: args{
url: "https://www.caranddriver.com/rss/all.xml/",
},
wantCode: 200,
wantRes: []byte{},
wantErr: RequestError{nil},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotCode, gotRes, gotErr := c.FetchFeed(tt.args.url)
if len(gotRes) == 0 {
t.Errorf("FetchFeed() gotRes = %v, want %v", gotRes, tt.wantRes)
}
if !reflect.DeepEqual(gotErr, tt.wantErr) {
t.Errorf("FetchFeed() gotErr = %v, want %v", gotErr, tt.wantErr)
}
if gotCode != tt.wantCode {
t.Errorf("FetchFeed() gotCode = %v, want %v", gotCode, tt.wantCode)
}
})
}
}