mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Fix other tests
This commit is contained in:
parent
24086e903f
commit
bb333edf69
3 changed files with 32 additions and 15 deletions
|
|
@ -53,16 +53,17 @@ func TestSessionToMap(t *testing.T) {
|
|||
}
|
||||
m := session.ToMap()
|
||||
sample := map[string]string{
|
||||
"timezone": "klsf",
|
||||
"keeponline": "false",
|
||||
"muc": "true",
|
||||
"rawmessages": "true",
|
||||
"asciiarrows": "false",
|
||||
"oobmode": "true",
|
||||
"carbons": "false",
|
||||
"hideids": "false",
|
||||
"receipts": "true",
|
||||
"nativeedits": "false",
|
||||
"timezone": "klsf",
|
||||
"keeponline": "false",
|
||||
"muc": "true",
|
||||
"rawmessages": "true",
|
||||
"asciiarrows": "false",
|
||||
"oobmode": "true",
|
||||
"carbons": "false",
|
||||
"hideids": "false",
|
||||
"receipts": "true",
|
||||
"nativeedits": "false",
|
||||
"ignoregroupdeletions": "false",
|
||||
}
|
||||
if !reflect.DeepEqual(m, sample) {
|
||||
t.Errorf("Map does not match the sample: %v", m)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue