update message test

This commit is contained in:
RCL98 2023-11-01 00:44:51 +02:00
parent 8f7e7f763e
commit 51427f0db1
1 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package message
import (
"bytes"
"crypto/rand"
"fmt"
"net"
@ -15,6 +16,18 @@ import (
var TypeMessage Type = "message"
// Test that the finished message is not encrypted
func TestMessageDontEncryptFinished(t *testing.T) {
log.SetLevel("debug")
m := Message{Type: TypeFinished, Message: "hello, world"}
e, salt, err := crypt.New([]byte("pass"), nil)
assert.Nil(t, err)
fmt.Println(string(salt))
b, err := Encode(e, m)
assert.Nil(t, err)
assert.True(t, bytes.Contains(b, []byte("hello, world")))
}
func TestMessage(t *testing.T) {
log.SetLevel("debug")
m := Message{Type: TypeMessage, Message: "hello, world"}