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/threema/bot_test.go

49 lines
709 B
Go

package threema
import (
"testing"
"dev.sum7.eu/genofire/thrempp/models"
"github.com/stretchr/testify/assert"
)
func TestBot(t *testing.T) {
assert := assert.New(t)
b := Bot{
jid: &models.JID{},
threema: &Threema{
bot: make(map[string]*Bot),
},
}
msg := b.Handle("help")
assert.NotEqual("", msg)
// getAccount
a, err := b.getAccount()
assert.NoError(err)
assert.Nil(a)
}
func TestGetBot(t *testing.T) {
assert := assert.New(t)
tr := Threema{
bot: make(map[string]*Bot),
}
jid := &models.JID{
Local: "a",
Domain: "example.org",
}
//
b := tr.getBot(jid)
assert.NotNil(b)
// getBot from cache
b = tr.getBot(jid)
assert.NotNil(b)
tr.bot = make(map[string]*Bot)
}