like_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package like
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_fmtStartEnd(t *testing.T) {
  9. Convey("test fmt start and end", t, WithService(func(s *Service) {
  10. pn := 1
  11. ps := 10
  12. cnt := 11
  13. typ := "random" //ctime random
  14. start, end, err := s.fmtStartEnd(pn, ps, cnt, typ)
  15. So(err, ShouldBeNil)
  16. Println(start, end)
  17. }))
  18. }
  19. func TestService_LikeInitialize(t *testing.T) {
  20. Convey("test LikeInitialize", t, WithService(func(s *Service) {
  21. lid := int64(13537)
  22. err := s.LikeInitialize(context.Background(), lid)
  23. time.Sleep(time.Second)
  24. So(err, ShouldBeNil)
  25. }))
  26. }
  27. func TestService_LikeMaxIDInitialize(t *testing.T) {
  28. Convey("test LikeInitialize", t, WithService(func(s *Service) {
  29. err := s.LikeMaxIDInitialize(context.Background())
  30. So(err, ShouldBeNil)
  31. }))
  32. }
  33. func TestService_LikeUp(t *testing.T) {
  34. Convey("test LikeUp", t, WithService(func(s *Service) {
  35. lid := int64(13538)
  36. err := s.LikeUp(context.Background(), lid)
  37. time.Sleep(time.Second)
  38. So(err, ShouldBeNil)
  39. }))
  40. }
  41. func TestService_AddLikeCtimeCache(t *testing.T) {
  42. Convey("test LikeUp", t, WithService(func(s *Service) {
  43. lid := int64(13540)
  44. err := s.AddLikeCtimeCache(context.Background(), lid)
  45. So(err, ShouldBeNil)
  46. }))
  47. }
  48. func TestService_DelLikeCtimeCache(t *testing.T) {
  49. Convey("test LikeUp", t, WithService(func(s *Service) {
  50. err := s.DelLikeCtimeCache(context.Background(), 13537, 10296, 5)
  51. So(err, ShouldBeNil)
  52. }))
  53. }
  54. func TestService_SetLikeContent(t *testing.T) {
  55. Convey("test LikeUp", t, WithService(func(s *Service) {
  56. err := s.SetLikeContent(context.Background(), 13511)
  57. So(err, ShouldBeNil)
  58. }))
  59. }
  60. func TestService_AddLikeActCache(t *testing.T) {
  61. Convey("test LikeUp", t, WithService(func(s *Service) {
  62. err := s.AddLikeActCache(context.Background(), 10296, 13528, 7)
  63. So(err, ShouldBeNil)
  64. }))
  65. }