Исправить замечания ревью кода: убрать повтор в AppendOnce за счёт запаса у чистки ключей, вынести MessagePayload и SameContent, принять X-Request-Id от балансировщика, упростить фоновые задачи сервера, сократить комментарии
This commit is contained in:
@@ -45,3 +45,16 @@ func TestNewMessageKeepsSurroundingWhitespace(t *testing.T) {
|
||||
t.Fatalf("text must be stored verbatim, got %q", m.Text)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSameContentComparesWhatTheSenderWrote(t *testing.T) {
|
||||
chatID, alice := ident.New(), ident.New()
|
||||
first, _ := chat.NewMessage(ident.New(), chatID, alice, "привет")
|
||||
retry, _ := chat.NewMessage(ident.New(), chatID, alice, "привет")
|
||||
other, _ := chat.NewMessage(ident.New(), chatID, alice, "привет!")
|
||||
if !first.SameContent(retry) {
|
||||
t.Fatal("messages with the same text must have the same content")
|
||||
}
|
||||
if first.SameContent(other) {
|
||||
t.Fatal("messages with different text must differ")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user