package pb import ( "testing" "github.com/stretchr/testify/require" ) func TestHash(t *testing.T) { expected := []byte{0xa5, 0x91, 0xa6, 0xd4, 0xb, 0xf4, 0x20, 0x40, 0x4a, 0x1, 0x17, 0x33, 0xcf, 0xb7, 0xb1, 0x90, 0xd6, 0x2c, 0x65, 0xbf, 0xb, 0xcd, 0xa3, 0x2b, 0x57, 0xb2, 0x77, 0xd9, 0xad, 0x9f, 0x14, 0x6e} result := Hash([]byte("Hello World")) require.Equal(t, expected, result) } func TestEnvelopeHash(t *testing.T) { msg := new(WakuMessage) msg.ContentTopic = "Test" msg.Payload = []byte("Hello World") msg.Timestamp = 123456789123456789 msg.Version = 1 expected := []byte{0xf8, 0xa4, 0x70, 0x32, 0x76, 0xf2, 0x36, 0x99, 0x24, 0xc5, 0xfe, 0x36, 0xee, 0x3a, 0x96, 0xcb, 0xca, 0x45, 0x54, 0xed, 0xd3, 0x1a, 0x19, 0xb1, 0x68, 0xac, 0x49, 0xe9, 0x26, 0xed, 0xb6, 0xc6} result, err := msg.Hash() require.NoError(t, err) require.Equal(t, expected, result) }