match_test.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/esports/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_Calendar(t *testing.T) {
  9. Convey("test service calendar", t, WithService(func(s *Service) {
  10. res, err := s.Calendar(context.Background(), &model.ParamFilter{Stime: "2018-07-27", Etime: "2018-08-02"})
  11. So(err, ShouldBeNil)
  12. So(len(res), ShouldBeGreaterThan, 0)
  13. }))
  14. }
  15. func TestService_FilterMatch(t *testing.T) {
  16. Convey("test service filterMatch", t, WithService(func(s *Service) {
  17. res, err := s.FilterMatch(context.Background(), &model.ParamFilter{Mid: 0})
  18. So(err, ShouldBeNil)
  19. So(len(res), ShouldBeGreaterThan, 0)
  20. }))
  21. }
  22. func TestService_FilterVideo(t *testing.T) {
  23. Convey("test service filterVideo", t, WithService(func(s *Service) {
  24. res, err := s.FilterVideo(context.Background(), &model.ParamFilter{Mid: 0})
  25. So(err, ShouldBeNil)
  26. So(len(res), ShouldBeGreaterThan, 0)
  27. }))
  28. }
  29. func TestService_ListVideo(t *testing.T) {
  30. Convey("test service listVideo", t, WithService(func(s *Service) {
  31. arg := &model.ParamVideo{
  32. Mid: int64(0),
  33. Gid: int64(0),
  34. Tid: int64(0),
  35. Year: int64(2018),
  36. Tag: int64(1),
  37. Pn: 1,
  38. Ps: 30,
  39. }
  40. res, total, err := s.ListVideo(context.Background(), arg)
  41. So(err, ShouldBeNil)
  42. So(len(res), ShouldBeGreaterThan, 0)
  43. println(total)
  44. }))
  45. }
  46. func TestService_ListContest(t *testing.T) {
  47. Convey("test service listContest", t, WithService(func(s *Service) {
  48. arg := &model.ParamContest{
  49. Mid: int64(0),
  50. GState: "0,3,4",
  51. Pn: 1,
  52. Ps: 10,
  53. }
  54. mid := int64(12309)
  55. res, total, err := s.ListContest(context.Background(), mid, arg)
  56. So(err, ShouldBeNil)
  57. So(len(res), ShouldBeGreaterThan, 0)
  58. println(total)
  59. }))
  60. }
  61. func TestService_Season(t *testing.T) {
  62. Convey("test service Season", t, WithService(func(s *Service) {
  63. arg := &model.ParamSeason{
  64. Pn: 1,
  65. Ps: 5,
  66. }
  67. res, count, err := s.Season(context.Background(), arg)
  68. So(err, ShouldBeNil)
  69. So(count, ShouldBeGreaterThan, 0)
  70. So(len(res), ShouldBeGreaterThan, 0)
  71. }))
  72. }