From 930557bda566d9e2ff577a707f3f6c5fd087a5f9 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Sat, 22 Aug 2026 17:57:14 -0400 Subject: [PATCH] Fix tests --- persistence/sessions_test.go | 1 + telegram/formatter/formatter_test.go | 8 ++++---- xmpp/gateway/gateway_test.go | 20 +++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/persistence/sessions_test.go b/persistence/sessions_test.go index 187445b..66c4115 100644 --- a/persistence/sessions_test.go +++ b/persistence/sessions_test.go @@ -64,6 +64,7 @@ func TestSessionToMap(t *testing.T) { "receipts": "true", "nativeedits": "false", "ignoregroupdeletions": "false", + "omemo": "auto", } if !reflect.DeepEqual(m, sample) { t.Errorf("Map does not match the sample: %v", m) diff --git a/telegram/formatter/formatter_test.go b/telegram/formatter/formatter_test.go index aaaca89..a3f5816 100644 --- a/telegram/formatter/formatter_test.go +++ b/telegram/formatter/formatter_test.go @@ -604,7 +604,7 @@ func TestUsernameMention(t *testing.T) { Type: &client.TextEntityTypeMention{}, }, }, MarkupModeXEP0393, &MentionRetrieverMock{}) - if markup != "a b c" { + if markup != "a @b c" { t.Errorf("Wrong mention formatting: %v", markup) } } @@ -617,7 +617,7 @@ func TestUsernameMentionName(t *testing.T) { Type: &client.TextEntityTypeMentionName{UserId: 100500}, }, }, MarkupModeXEP0393, &MentionRetrieverMock{}) - if markup != "a 42 c" { + if markup != "a @42 c" { t.Errorf("Wrong mention name formatting: %v", markup) } } @@ -635,7 +635,7 @@ func TestUsernameMentionNested(t *testing.T) { Type: &client.TextEntityTypeBold{}, }, }, MarkupModeXEP0393, &MentionRetrieverMock{}) - if markup != "a b c" { + if markup != "a @b c" { t.Errorf("Wrong formatting of mention with nested entity: %v", markup) } } @@ -653,7 +653,7 @@ func TestUsernameMentionNestedEven(t *testing.T) { Type: &client.TextEntityTypeBold{}, }, }, MarkupModeXEP0393, &MentionRetrieverMock{}) - if markup != "a *b* c" { + if markup != "a *@b* c" { t.Errorf("Wrong formatting of mention with even nested entity: %v", markup) } } diff --git a/xmpp/gateway/gateway_test.go b/xmpp/gateway/gateway_test.go index 629aeba..c7b1946 100644 --- a/xmpp/gateway/gateway_test.go +++ b/xmpp/gateway/gateway_test.go @@ -97,15 +97,17 @@ func TestDiscoVerPsi(t *testing.T) { {Var: "http://jabber.org/protocol/muc"}, {Var: "http://jabber.org/protocol/caps"}, }, - Form: &stanza.Form{ - Type: "result", - Fields: []*stanza.Field{ - {Var: "FORM_TYPE", Type: "hidden", ValuesList: []string{"urn:xmpp:dataforms:softwareinfo"}}, - {Var: "ip_version", Type: "text-multi", ValuesList: []string{"ipv4", "ipv6"}}, - {Var: "os", ValuesList: []string{"Mac"}}, - {Var: "os_version", ValuesList: []string{"10.5.1"}}, - {Var: "software", ValuesList: []string{"Psi"}}, - {Var: "software_version", ValuesList: []string{"0.11"}}, + Forms: []*stanza.Form{ + { + Type: "result", + Fields: []*stanza.Field{ + {Var: "FORM_TYPE", Type: "hidden", ValuesList: []string{"urn:xmpp:dataforms:softwareinfo"}}, + {Var: "ip_version", Type: "text-multi", ValuesList: []string{"ipv4", "ipv6"}}, + {Var: "os", ValuesList: []string{"Mac"}}, + {Var: "os_version", ValuesList: []string{"10.5.1"}}, + {Var: "software", ValuesList: []string{"Psi"}}, + {Var: "software_version", ValuesList: []string{"0.11"}}, + }, }, }, }