-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSendLocation_test.go
56 lines (52 loc) · 1012 Bytes
/
SendLocation_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
package telegram
import (
"fmt"
"os"
"testing"
)
func TestSendLocation(t *testing.T) {
type args struct {
botToken string
chatId string
location Location
}
tests := []struct {
name string
args args
want error
}{
{
name: "TestSendLocation",
args: args{
botToken: os.Getenv("TELEGRAM_BOT_TOKEN"),
chatId: os.Getenv("TELEGRAM_CHAT_ID"),
location: Location{
Longitude: 0,
Latitude: 0,
},
},
want: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := SendLocation(tt.args.botToken, tt.args.chatId, tt.args.location)
if err != tt.want {
t.Errorf("SendLocation() = %v, want %v", err, tt.want)
}
})
}
}
func ExampleSendLocation() {
botToken := os.Getenv("TELEGRAM_BOT_TOKEN")
chatId := os.Getenv("TELEGRAM_CHAT_ID")
location := Location{
Longitude: 0,
Latitude: 0,
}
message, err := SendLocation(botToken, chatId, location)
if err != nil {
panic(err)
}
fmt.Println(message.Location)
}