go-common/app/job/main/broadcast/service/service_test.go
2019-04-22 18:49:16 +08:00

39 lines
824 B
Go

package service
import (
"testing"
"go-common/app/job/main/broadcast/conf"
. "github.com/smartystreets/goconvey/convey"
)
func TestNewService(t *testing.T) {
Convey("TestNewService", t, func() {
s := New(conf.Conf)
So(s, ShouldNotBeNil)
Convey("TestPush", func() {
err := s.pushMsg([]byte("test"))
So(err, ShouldBeNil)
})
Convey("TestPushComet", func() {
s.pushKeys(1, "test", nil, []byte("test"), 0)
})
Convey("TestBroadCast", func() {
s.broadcast(1, []byte("test"), 100, "", 0)
})
Convey("TestBroadCast", func() {
s.broadcastRoomRawBytes("1", []byte("test"))
})
Convey("TestNewRoom", func() {
r := NewRoom(s, "test", RoomOptions{})
So(r, ShouldNotBeNil)
Convey("TestNewPush", func() {
err := r.Push(7, []byte("test"), 0)
So(err, ShouldBeNil)
})
})
})
}