forked from gotd/botapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage_invite_test.go
More file actions
30 lines (24 loc) · 889 Bytes
/
Copy pathcoverage_invite_test.go
File metadata and controls
30 lines (24 loc) · 889 Bytes
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
package botapi
import (
"context"
"testing"
)
// TestInviteLinkErrorsOnPrivate covers the resolveInviteLinks error branch of
// every invite-link method: a private (user) chat has no invite links.
func TestInviteLinkErrorsOnPrivate(t *testing.T) {
b := newMockBot(newMockInvoker())
ctx := context.Background()
chat := userRef(10, 20)
if _, err := b.ExportChatInviteLink(ctx, chat); err == nil {
t.Fatal("ExportChatInviteLink on private chat should fail")
}
if _, err := b.CreateChatInviteLink(ctx, chat); err == nil {
t.Fatal("CreateChatInviteLink on private chat should fail")
}
if _, err := b.EditChatInviteLink(ctx, chat, "https://t.me/+x"); err == nil {
t.Fatal("EditChatInviteLink on private chat should fail")
}
if _, err := b.RevokeChatInviteLink(ctx, chat, "https://t.me/+x"); err == nil {
t.Fatal("RevokeChatInviteLink on private chat should fail")
}
}