Fix other tests

This commit is contained in:
Bohdan Horbeshko 2025-07-13 06:13:45 -04:00
parent 24086e903f
commit bb333edf69
3 changed files with 32 additions and 15 deletions

View file

@ -63,6 +63,7 @@ func TestSessionToMap(t *testing.T) {
"hideids": "false",
"receipts": "true",
"nativeedits": "false",
"ignoregroupdeletions": "false",
}
if !reflect.DeepEqual(m, sample) {
t.Errorf("Map does not match the sample: %v", m)

View file

@ -74,7 +74,7 @@ func (c *Client) wizardStageOrPrompt(stage, message string) {
log.Debugf("writing wizard stage %v", stage)
c.loginWizard.nextStage <- stage
} else {
log.Warn("Skipping stage %v, wizard cannot keep up", stage)
log.Warnf("Skipping stage %v, wizard cannot keep up", stage)
}
c.loginWizard.chanBusy = true
c.locks.loginWizardWriteLock.Unlock()

View file

@ -68,12 +68,28 @@ func TestFormatMessageOneline(t *testing.T) {
},
}
text := (&Client{}).formatMessage(0, 0, true, &message)
text := (&Client{}).formatMessage(0, 0, true, true, &message)
if text != "42 | | tist" {
t.Errorf("Wrong oneline message formatting: %v", text)
}
}
func TestFormatMessageNoSender(t *testing.T) {
message := client.Message{
Id: 42,
Content: &client.MessageText{
Text: &client.FormattedText{
Text: "tist",
},
},
}
text := (&Client{}).formatMessage(0, 0, true, false, &message)
if text != "42 | tist" {
t.Errorf("Wrong nosender message formatting: %v", text)
}
}
func TestFormatMessageMultiline(t *testing.T) {
message := client.Message{
Id: 42,
@ -84,7 +100,7 @@ func TestFormatMessageMultiline(t *testing.T) {
},
}
text := (&Client{}).formatMessage(0, 0, true, &message)
text := (&Client{}).formatMessage(0, 0, true, true, &message)
if text != "42 | | tist" {
t.Errorf("Wrong multiline message formatting: %v", text)
}
@ -104,7 +120,7 @@ func TestFormatMessageOnelinePreview(t *testing.T) {
c := &Client{
Session: &persistence.Session{},
}
text := c.formatMessage(0, 0, false, &message)
text := c.formatMessage(0, 0, false, true, &message)
if text != "42 | | 10 Jan 2008 21:20:00 | tist" {
t.Errorf("Wrong oneline preview message formatting: %v", text)
}
@ -124,7 +140,7 @@ func TestFormatMessageMultilinePreview(t *testing.T) {
c := &Client{
Session: &persistence.Session{},
}
text := c.formatMessage(0, 0, false, &message)
text := c.formatMessage(0, 0, false, true, &message)
if text != "42 | | 10 Jan 2008 21:20:00 | tist\nziz" {
t.Errorf("Wrong multiline preview message formatting: %v", text)
}