merged from gramsrv upstream
This commit is contained in:
parent
79c64ee916
commit
21a0856587
651 changed files with 54774 additions and 4590 deletions
|
|
@ -1,10 +1,32 @@
|
|||
package domain
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMessageRichMessageMissingBlocksLayerIsLegacy228(t *testing.T) {
|
||||
var rich MessageRichMessage
|
||||
if err := json.Unmarshal([]byte(`{"blocks":"FQ=="}`), &rich); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := rich.EffectiveBlocksLayer(); got != MessageRichBlocksLegacyLayer {
|
||||
t.Fatalf("effective blocks layer = %d, want %d", got, MessageRichBlocksLegacyLayer)
|
||||
}
|
||||
if rich.BlocksLayer != 0 {
|
||||
t.Fatalf("legacy JSON mutated stored blocks layer to %d", rich.BlocksLayer)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessageRichMessageExplicitBlocksLayer(t *testing.T) {
|
||||
const storedLayer = 230
|
||||
rich := MessageRichMessage{BlocksLayer: storedLayer}
|
||||
if got := rich.EffectiveBlocksLayer(); got != storedLayer {
|
||||
t.Fatalf("effective blocks layer = %d, want %d", got, storedLayer)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateMessageReplyBoundsRejectsQuoteOffsetAsTextOffset(t *testing.T) {
|
||||
reply := &MessageReply{
|
||||
MessageID: 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue