-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage_test.go
51 lines (48 loc) · 1.01 KB
/
message_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
package zgo_test
import (
"testing"
"github.com/toanppp/zgo"
)
func TestLink_String(t *testing.T) {
type fields struct {
Title string
URL string
Thumb string
Description string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "link",
fields: fields{
URL: "https://google.com",
},
want: "https://google.com",
},
{
name: "number",
fields: fields{
Title: "Name",
URL: "https://zalo.me",
Description: "{\"phone\":\"767263039\",\"caption\":\"767263039\",\"qrCodeUrl\":\"https:\\/\\/qr-talk.zdn.vn\\/9\\/77327221\\/b7b2f11d85566c083547.jpg\"}",
},
want: "767263039",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
l := zgo.Link{
Title: tt.fields.Title,
URL: tt.fields.URL,
Thumb: tt.fields.Thumb,
Description: tt.fields.Description,
}
if got := l.String(); got != tt.want {
t.Errorf("String() = %v, want %v", got, tt.want)
}
})
}
}