databus_test.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoPushMsg(t *testing.T) {
  8. var (
  9. c = context.Background()
  10. op = int32(0)
  11. server = ""
  12. msg = ""
  13. keys = []string{"key"}
  14. contentType = int32(0)
  15. )
  16. convey.Convey("PushMsg", t, func(ctx convey.C) {
  17. err := d.PushMsg(c, op, server, msg, keys, contentType)
  18. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  19. ctx.So(err, convey.ShouldBeNil)
  20. })
  21. })
  22. }
  23. func TestDaoBroadcastRoomMsg(t *testing.T) {
  24. var (
  25. c = context.Background()
  26. op = int32(0)
  27. room = ""
  28. msg = ""
  29. contentType = int32(0)
  30. )
  31. convey.Convey("BroadcastRoomMsg", t, func(ctx convey.C) {
  32. err := d.BroadcastRoomMsg(c, op, room, msg, contentType)
  33. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  34. ctx.So(err, convey.ShouldBeNil)
  35. })
  36. })
  37. }
  38. func TestDaoBroadcastMsg(t *testing.T) {
  39. var (
  40. c = context.Background()
  41. op = int32(0)
  42. speed = int32(0)
  43. msg = ""
  44. platform = ""
  45. contentType = int32(0)
  46. )
  47. convey.Convey("BroadcastMsg", t, func(ctx convey.C) {
  48. err := d.BroadcastMsg(c, op, speed, msg, platform, contentType)
  49. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  50. ctx.So(err, convey.ShouldBeNil)
  51. })
  52. })
  53. }