saltyim is the Go library and reference client and broker implementation for Salty IM it contains a command-line client (cli), a terminal user interface (tui), builtin server/broker and a Mobile / Desktop App PWA (progressive web app)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
689 B

package saltyim
import (
func TestPackMessage(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
addr, err := ParseAddr("")
assert.Equal("alice", addr.User)
assert.Equal("", addr.Domain)
msg := "Hello World!"
packed := PackMessage(addr, msg)
s, err := lextwt.ParseSalty(string(packed))
st, ok := s.(*lextwt.SaltyText)
require.Equal(true, ok)
assert.Equal("", st.User.String())
assert.Equal("Hello World!", st.LiteralText())