online_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoOnlineCount(t *testing.T) {
  8. convey.Convey("OnlineCount", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. data, err := d.OnlineCount(c)
  14. ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(data, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaoLiveOnlineCount(t *testing.T) {
  22. convey.Convey("LiveOnlineCount", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. )
  26. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  27. data, err := d.LiveOnlineCount(c)
  28. ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(data, convey.ShouldNotBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestDaoOnlineList(t *testing.T) {
  36. convey.Convey("OnlineList", t, func(ctx convey.C) {
  37. var (
  38. c = context.Background()
  39. num = int64(0)
  40. )
  41. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  42. data, err := d.OnlineList(c, num)
  43. ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. ctx.So(data, convey.ShouldNotBeNil)
  46. })
  47. })
  48. })
  49. }