reply_test.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/figure/model"
  6. repmol "go-common/app/job/main/reply/model/reply"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. var (
  10. testReplyMid int64 = 120
  11. testRefReplyMid int64 = 121
  12. )
  13. // go test -test.v -test.run TestPutReplyInfo
  14. func TestPutReplyInfo(t *testing.T) {
  15. Convey("TestPutReplyInfo put add reply", t, WithService(func(s *Service) {
  16. So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
  17. Mid: testReplyMid,
  18. Action: model.EventAdd,
  19. Reply: &repmol.Reply{
  20. Mid: testRefReplyMid,
  21. },
  22. }), ShouldBeNil)
  23. }))
  24. Convey("TestPutReplyInfo put add reply", t, WithService(func(s *Service) {
  25. So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
  26. Mid: testReplyMid,
  27. Action: model.EventLike,
  28. Reply: &repmol.Reply{
  29. Mid: testRefReplyMid,
  30. },
  31. }), ShouldBeNil)
  32. So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
  33. Mid: testReplyMid,
  34. Action: model.EventLike,
  35. Reply: &repmol.Reply{
  36. Mid: testRefReplyMid,
  37. },
  38. }), ShouldBeNil)
  39. }))
  40. Convey("TestPutReplyInfo put add reply", t, WithService(func(s *Service) {
  41. So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
  42. Mid: testReplyMid,
  43. Action: model.EventLikeCancel,
  44. Reply: &repmol.Reply{
  45. Mid: testRefReplyMid,
  46. },
  47. }), ShouldBeNil)
  48. }))
  49. Convey("TestPutReplyInfo put hate", t, WithService(func(s *Service) {
  50. So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
  51. Mid: testReplyMid,
  52. Action: model.EventHate,
  53. Reply: &repmol.Reply{
  54. Mid: testRefReplyMid,
  55. },
  56. }), ShouldBeNil)
  57. }))
  58. Convey("TestPutReplyInfo put hate cancel", t, WithService(func(s *Service) {
  59. So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
  60. Mid: testReplyMid,
  61. Action: model.EventHateCancel,
  62. Reply: &repmol.Reply{
  63. Mid: testRefReplyMid,
  64. },
  65. }), ShouldBeNil)
  66. }))
  67. }