mysql_test.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package esports
  2. import (
  3. "context"
  4. "testing"
  5. mdlesp "go-common/app/job/main/web-goblin/model/esports"
  6. arcmdl "go-common/app/service/main/archive/api"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestEsportsContests(t *testing.T) {
  10. var (
  11. c = context.Background()
  12. stime = int64(1539590040)
  13. etime = int64(1539590040)
  14. )
  15. convey.Convey("Contests", t, func(ctx convey.C) {
  16. res, err := d.Contests(c, stime, etime)
  17. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(len(res), convey.ShouldBeGreaterThanOrEqualTo, 0)
  20. })
  21. })
  22. }
  23. func TestEsportsTeams(t *testing.T) {
  24. var (
  25. c = context.Background()
  26. homeID = int64(1)
  27. awayID = int64(2)
  28. )
  29. convey.Convey("Teams", t, func(ctx convey.C) {
  30. res, err := d.Teams(c, homeID, awayID)
  31. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldBeNil)
  33. ctx.So(len(res), convey.ShouldBeGreaterThanOrEqualTo, 0)
  34. })
  35. })
  36. }
  37. func TestEsportsArcs(t *testing.T) {
  38. var (
  39. c = context.Background()
  40. id = int64(1)
  41. limit = int(50)
  42. )
  43. convey.Convey("Arcs", t, func(ctx convey.C) {
  44. res, err := d.Arcs(c, id, limit)
  45. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. ctx.So(res, convey.ShouldNotBeNil)
  48. })
  49. })
  50. }
  51. func TestEsportsUpArcScore(t *testing.T) {
  52. var (
  53. c = context.Background()
  54. partArcs = []*mdlesp.Arc{}
  55. arcs map[int64]*arcmdl.Arc
  56. )
  57. convey.Convey("UpArcScore", t, func(ctx convey.C) {
  58. err := d.UpArcScore(c, partArcs, arcs)
  59. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  60. ctx.So(err, convey.ShouldBeNil)
  61. })
  62. })
  63. }
  64. func TestEsportsscore(t *testing.T) {
  65. var (
  66. arc = &arcmdl.Arc{}
  67. )
  68. convey.Convey("score", t, func(ctx convey.C) {
  69. res := d.score(arc)
  70. ctx.Convey("Then res should not be nil.", func(ctx convey.C) {
  71. ctx.So(res, convey.ShouldNotBeNil)
  72. })
  73. })
  74. }