Fix tests

This commit is contained in:
Bohdan Horbeshko 2023-11-16 08:05:23 -05:00
parent 6bd8379114
commit dcb802358b
3 changed files with 28 additions and 26 deletions

19
telegabber_test.go Normal file
View file

@ -0,0 +1,19 @@
package main
import (
"testing"
)
func TestTdlibLogInfo(t *testing.T) {
tdlibConstant := stringToTdlibLogConstant(":info")
if tdlibConstant != 3 {
t.Errorf("Wrong TDlib constant for info")
}
}
func TestTdlibLogInvalid(t *testing.T) {
tdlibConstant := stringToTdlibLogConstant("ziz")
if tdlibConstant != 0 {
t.Errorf("Unknown strings should return fatal loglevel")
}
}

View file

@ -1,19 +0,0 @@
package telegram
import (
"testing"
)
func TestLogInfo(t *testing.T) {
tdlibConstant := stringToLogConstant(":info")
if tdlibConstant != 3 {
t.Errorf("Wrong TDlib constant for info")
}
}
func TestLogInvalid(t *testing.T) {
tdlibConstant := stringToLogConstant("ziz")
if tdlibConstant != 0 {
t.Errorf("Unknown strings should return fatal loglevel")
}
}

View file

@ -431,7 +431,7 @@ func TestMessageToPrefix1(t *testing.T) {
Id: 42, Id: 42,
IsOutgoing: true, IsOutgoing: true,
ForwardInfo: &client.MessageForwardInfo{ ForwardInfo: &client.MessageForwardInfo{
Origin: &client.MessageForwardOriginHiddenUser{ Origin: &client.MessageOriginHiddenUser{
SenderName: "ziz", SenderName: "ziz",
}, },
}, },
@ -452,7 +452,7 @@ func TestMessageToPrefix2(t *testing.T) {
message := client.Message{ message := client.Message{
Id: 56, Id: 56,
ForwardInfo: &client.MessageForwardInfo{ ForwardInfo: &client.MessageForwardInfo{
Origin: &client.MessageForwardOriginChannel{ Origin: &client.MessageOriginChannel{
AuthorSignature: "zaz", AuthorSignature: "zaz",
}, },
}, },
@ -473,7 +473,7 @@ func TestMessageToPrefix3(t *testing.T) {
message := client.Message{ message := client.Message{
Id: 56, Id: 56,
ForwardInfo: &client.MessageForwardInfo{ ForwardInfo: &client.MessageForwardInfo{
Origin: &client.MessageForwardOriginChannel{ Origin: &client.MessageOriginChannel{
AuthorSignature: "zuz", AuthorSignature: "zuz",
}, },
}, },
@ -511,7 +511,7 @@ func TestMessageToPrefix5(t *testing.T) {
message := client.Message{ message := client.Message{
Id: 560, Id: 560,
ForwardInfo: &client.MessageForwardInfo{ ForwardInfo: &client.MessageForwardInfo{
Origin: &client.MessageForwardOriginChat{ Origin: &client.MessageOriginChat{
AuthorSignature: "zyz", AuthorSignature: "zyz",
}, },
}, },
@ -532,7 +532,9 @@ func TestMessageToPrefix6(t *testing.T) {
message := client.Message{ message := client.Message{
Id: 23, Id: 23,
IsOutgoing: true, IsOutgoing: true,
ReplyToMessageId: 42, ReplyTo: &client.MessageReplyToMessage{
MessageId: 42,
},
} }
reply := client.Message{ reply := client.Message{
Id: 42, Id: 42,