This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
thrempp/component/send_test.go

31 lines
621 B
Go

package component
import (
"testing"
"github.com/stretchr/testify/assert"
"gosrc.io/xmpp/stanza"
)
func TestSend(t *testing.T) {
assert := assert.New(t)
c := Config{Host: "example.org", XMPPDebug: true}
// ignoring packet
p := c.sending(stanza.IQ{})
assert.Nil(p)
// send by component host
p = c.sending(stanza.Message{})
assert.NotNil(p)
msg := p.(stanza.Message)
assert.Equal("example.org", msg.From)
// send by a user of component
p = c.sending(stanza.Message{Attrs: stanza.Attrs{From: "threemaid"}})
assert.NotNil(p)
msg = p.(stanza.Message)
assert.Equal("threemaid@example.org", msg.From)
}