aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils_test.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-03-08 16:39:43 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-03-08 16:39:43 +0300
commit7bd165a738d6c39d2f9e530c67118f8c639ffb0b (patch)
tree1c1a39041e134f6918540bc2bfad78976320794e /telegram/utils_test.go
parentb1135b070b751998cb98eded6d29bdd7b800ecb9 (diff)
Fix tests
Diffstat (limited to 'telegram/utils_test.go')
-rw-r--r--telegram/utils_test.go48
1 files changed, 42 insertions, 6 deletions
diff --git a/telegram/utils_test.go b/telegram/utils_test.go
index 03ab8bd..91002ee 100644
--- a/telegram/utils_test.go
+++ b/telegram/utils_test.go
@@ -389,10 +389,16 @@ func TestMessageToPrefix1(t *testing.T) {
},
},
}
- prefix := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "", "", nil)
+ prefix, replyStart, replyEnd := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "", "", nil)
if prefix != "➡ 42 | fwd: ziz" {
t.Errorf("Wrong prefix: %v", prefix)
}
+ if replyStart != 0 {
+ t.Errorf("Wrong replyStart: %v", replyStart)
+ }
+ if replyEnd != 0 {
+ t.Errorf("Wrong replyEnd: %v", replyEnd)
+ }
}
func TestMessageToPrefix2(t *testing.T) {
@@ -404,10 +410,16 @@ func TestMessageToPrefix2(t *testing.T) {
},
},
}
- prefix := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "y.jpg", "", nil)
+ prefix, replyStart, replyEnd := (&Client{Session: &persistence.Session{}}).messageToPrefix(&message, "y.jpg", "", nil)
if prefix != "⬅ 56 | fwd: (zaz) | preview: y.jpg" {
t.Errorf("Wrong prefix: %v", prefix)
}
+ if replyStart != 0 {
+ t.Errorf("Wrong replyStart: %v", replyStart)
+ }
+ if replyEnd != 0 {
+ t.Errorf("Wrong replyEnd: %v", replyEnd)
+ }
}
func TestMessageToPrefix3(t *testing.T) {
@@ -419,10 +431,16 @@ func TestMessageToPrefix3(t *testing.T) {
},
},
}
- prefix := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "a.jpg", nil)
+ prefix, replyStart, replyEnd := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "a.jpg", nil)
if prefix != "< 56 | fwd: (zuz) | file: a.jpg" {
t.Errorf("Wrong prefix: %v", prefix)
}
+ if replyStart != 0 {
+ t.Errorf("Wrong replyStart: %v", replyStart)
+ }
+ if replyEnd != 0 {
+ t.Errorf("Wrong replyEnd: %v", replyEnd)
+ }
}
func TestMessageToPrefix4(t *testing.T) {
@@ -430,10 +448,16 @@ func TestMessageToPrefix4(t *testing.T) {
Id: 23,
IsOutgoing: true,
}
- prefix := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", nil)
+ prefix, replyStart, replyEnd := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", nil)
if prefix != "> 23" {
t.Errorf("Wrong prefix: %v", prefix)
}
+ if replyStart != 0 {
+ t.Errorf("Wrong replyStart: %v", replyStart)
+ }
+ if replyEnd != 0 {
+ t.Errorf("Wrong replyEnd: %v", replyEnd)
+ }
}
func TestMessageToPrefix5(t *testing.T) {
@@ -445,10 +469,16 @@ func TestMessageToPrefix5(t *testing.T) {
},
},
}
- prefix := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "h.jpg", "a.jpg", nil)
+ prefix, replyStart, replyEnd := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "h.jpg", "a.jpg", nil)
if prefix != "< 560 | fwd: (zyz) | preview: h.jpg | file: a.jpg" {
t.Errorf("Wrong prefix: %v", prefix)
}
+ if replyStart != 0 {
+ t.Errorf("Wrong replyStart: %v", replyStart)
+ }
+ if replyEnd != 0 {
+ t.Errorf("Wrong replyEnd: %v", replyEnd)
+ }
}
func TestMessageToPrefix6(t *testing.T) {
@@ -465,10 +495,16 @@ func TestMessageToPrefix6(t *testing.T) {
},
},
}
- prefix := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", &reply)
+ prefix, replyStart, replyEnd := (&Client{Session: &persistence.Session{AsciiArrows: true}}).messageToPrefix(&message, "", "", &reply)
if prefix != "> 23 | reply: 42 | | tist" {
t.Errorf("Wrong prefix: %v", prefix)
}
+ if replyStart != 4 {
+ t.Errorf("Wrong replyStart: %v", replyStart)
+ }
+ if replyEnd != 26 {
+ t.Errorf("Wrong replyEnd: %v", replyEnd)
+ }
}
func GetSenderIdEmpty(t *testing.T) {