aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils_test.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-01 04:25:24 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-01 04:25:24 +0300
commitef831fc9725601a94149ce94c3fb686afc77e0a5 (patch)
tree4046e57e03097d9af33cde558056cd5393fa77f4 /telegram/utils_test.go
parent748366ad6a9dc4b2a269d5499ae1d5d7e8526762 (diff)
Migrate to TDLib 1.8.14 (multiple usernames support)
Diffstat (limited to 'telegram/utils_test.go')
-rw-r--r--telegram/utils_test.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/telegram/utils_test.go b/telegram/utils_test.go
index 91002ee..18be215 100644
--- a/telegram/utils_test.go
+++ b/telegram/utils_test.go
@@ -369,6 +369,53 @@ func TestMessageAnimation(t *testing.T) {
}
}
+func TestMessageTtl1(t *testing.T) {
+ ttl := client.Message{
+ Content: &client.MessageChatSetMessageAutoDeleteTime{},
+ }
+ text := (&Client{}).messageToText(&ttl, false)
+ if text != "The self-destruct timer was disabled" {
+ t.Errorf("Wrong anonymous off ttl label: %v", text)
+ }
+}
+
+func TestMessageTtl2(t *testing.T) {
+ ttl := client.Message{
+ Content: &client.MessageChatSetMessageAutoDeleteTime{
+ MessageAutoDeleteTime: 3,
+ },
+ }
+ text := (&Client{}).messageToText(&ttl, false)
+ if text != "The self-destruct timer was set to 3 seconds" {
+ t.Errorf("Wrong anonymous ttl label: %v", text)
+ }
+}
+
+func TestMessageTtl3(t *testing.T) {
+ ttl := client.Message{
+ Content: &client.MessageChatSetMessageAutoDeleteTime{
+ FromUserId: 3,
+ },
+ }
+ text := (&Client{}).messageToText(&ttl, false)
+ if text != "unknown contact: TDlib instance is offline disabled the self-destruct timer" {
+ t.Errorf("Wrong off ttl label: %v", text)
+ }
+}
+
+func TestMessageTtl4(t *testing.T) {
+ ttl := client.Message{
+ Content: &client.MessageChatSetMessageAutoDeleteTime{
+ FromUserId: 3,
+ MessageAutoDeleteTime: 3,
+ },
+ }
+ text := (&Client{}).messageToText(&ttl, false)
+ if text != "unknown contact: TDlib instance is offline set the self-destruct timer to 3 seconds" {
+ t.Errorf("Wrong ttl label: %v", text)
+ }
+}
+
func TestMessageUnknown(t *testing.T) {
unknown := client.Message{
Content: &client.MessageExpiredPhoto{},