forked from g8rswimmer/go-twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_dictionary_test.go
61 lines (59 loc) · 1.89 KB
/
user_dictionary_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
package twitter
import (
"reflect"
"testing"
)
func TestCreateUserDictionary(t *testing.T) {
type args struct {
user UserObj
includes *UserRawIncludes
}
tests := []struct {
name string
args args
want *UserDictionary
}{
{
name: "success",
args: args{
user: UserObj{
ID: "2244994945",
Name: "Twitter Dev",
UserName: "TwitterDev",
CreatedAt: "2013-12-14T04:35:55.000Z",
PinnedTweetID: "1255542774432063488",
},
includes: &UserRawIncludes{
Tweets: []*TweetObj{
{
ID: "1255542774432063488",
CreatedAt: "2020-04-29T17:01:38.000Z",
Text: "During these unprecedented times, what’s happening on Twitter can help the world better understand & respond to the pandemic. \n\nWe're launching a free COVID-19 stream endpoint so qualified devs & researchers can study the public conversation in real-time. https://t.co/BPqMcQzhId",
},
},
},
},
want: &UserDictionary{
User: UserObj{
ID: "2244994945",
Name: "Twitter Dev",
UserName: "TwitterDev",
CreatedAt: "2013-12-14T04:35:55.000Z",
PinnedTweetID: "1255542774432063488",
},
PinnedTweet: &TweetObj{
ID: "1255542774432063488",
CreatedAt: "2020-04-29T17:01:38.000Z",
Text: "During these unprecedented times, what’s happening on Twitter can help the world better understand & respond to the pandemic. \n\nWe're launching a free COVID-19 stream endpoint so qualified devs & researchers can study the public conversation in real-time. https://t.co/BPqMcQzhId",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CreateUserDictionary(tt.args.user, tt.args.includes); !reflect.DeepEqual(got, tt.want) {
t.Errorf("CreateUserDictionary() = %v, want %v", got, tt.want)
}
})
}
}