diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2024-04-27 07:31:21 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2024-04-27 07:31:21 +0300 |
commit | a3f6d5f77402bf4a4d3fa01297f9fd78cc69a3b3 (patch) | |
tree | 41458be4520e15c1de22d9c1dba8d37c54c48c73 /telegram/utils_test.go | |
parent | 2459b14948e71a5db640b63a41720f2b197f3fd4 (diff) |
Support nativeedits for rawmessages=falsev1.9.3
Diffstat (limited to 'telegram/utils_test.go')
-rw-r--r-- | telegram/utils_test.go | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/telegram/utils_test.go b/telegram/utils_test.go index fa9c107..005d17b 100644 --- a/telegram/utils_test.go +++ b/telegram/utils_test.go @@ -436,7 +436,7 @@ func TestMessageToPrefix1(t *testing.T) { }, }, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "", "") + prefix, gatewayReply := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "", "", false) if prefix != "➡ 42 | fwd: ziz" { t.Errorf("Wrong prefix: %v", prefix) } @@ -454,7 +454,7 @@ func TestMessageToPrefix2(t *testing.T) { }, }, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "y.jpg", "") + prefix, gatewayReply := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "y.jpg", "", false) if prefix != "⬅ 56 | fwd: (zaz) | preview: y.jpg" { t.Errorf("Wrong prefix: %v", prefix) } @@ -472,7 +472,7 @@ func TestMessageToPrefix3(t *testing.T) { }, }, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "a.jpg") + prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "a.jpg", false) if prefix != "< 56 | fwd: (zuz) | file: a.jpg" { t.Errorf("Wrong prefix: %v", prefix) } @@ -486,7 +486,7 @@ func TestMessageToPrefix4(t *testing.T) { Id: 23, IsOutgoing: true, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "") + prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", false) if prefix != "> 23" { t.Errorf("Wrong prefix: %v", prefix) } @@ -504,7 +504,7 @@ func TestMessageToPrefix5(t *testing.T) { }, }, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "h.jpg", "a.jpg") + prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "h.jpg", "a.jpg", false) if prefix != "< 560 | fwd: (zyz) | preview: h.jpg | file: a.jpg" { t.Errorf("Wrong prefix: %v", prefix) } @@ -530,7 +530,7 @@ func TestMessageToPrefix6(t *testing.T) { }, }, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "") + prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", false) if prefix != "> 23 | reply: ziz @ unknown contact: TDlib instance is offline | tist uz iz" { t.Errorf("Wrong prefix: %v", prefix) } @@ -556,7 +556,7 @@ func TestMessageToPrefix7(t *testing.T) { }, }, } - prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "") + prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", false) if prefix != "> 23 | reply: (zaz) @ unknown contact: TDlib instance is offline | tist" { t.Errorf("Wrong prefix: %v", prefix) } @@ -565,6 +565,32 @@ func TestMessageToPrefix7(t *testing.T) { } } +func TestMessageToPrefix8(t *testing.T) { + message := client.Message{ + Id: 23, + ChatId: 42, + IsOutgoing: true, + ReplyTo: &client.MessageReplyToMessage{ + ChatId: 41, + Content: &client.MessageText{ + Text: &client.FormattedText{ + Text: "tist", + }, + }, + Origin: &client.MessageOriginChannel{ + AuthorSignature: "zuz", + }, + }, + } + prefix, gatewayReply := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", true) + if prefix != "> 23" { + t.Errorf("Wrong prefix: %v", prefix) + } + if gatewayReply != nil { + t.Errorf("Reply is not nil: %v", gatewayReply) + } +} + func GetSenderIdEmpty(t *testing.T) { message := client.Message{} senderId := (&Client{}).getSenderId(&message) |