github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/p2p/p2putil/message_test.go (about) 1 package p2putil 2 3 import ( 4 "bytes" 5 "testing" 6 "time" 7 ) 8 9 func TestMessageUpdate(t *testing.T) { 10 a := Message{ 11 ID: "a", 12 Created: time.Now(), 13 Deadline: time.Now().Add(time.Minute), 14 Body: []byte("foo"), 15 } 16 17 b := a.Update([]byte("bar")) 18 19 if !bytes.Equal(b.Body, []byte("bar")) { 20 t.Errorf("payload mismatch. expected %s, got: %s", "bar", string(b.Body)) 21 } 22 }