operate_test.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. package feed
  2. import (
  3. "context"
  4. "reflect"
  5. "testing"
  6. "go-common/app/interface/main/app-card/model/card/live"
  7. "go-common/app/interface/main/app-card/model/card/operate"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestService_convergeCard(t *testing.T) {
  11. type args struct {
  12. c context.Context
  13. limit int
  14. ids []int64
  15. }
  16. tests := []struct {
  17. name string
  18. args args
  19. wantCardm map[int64]*operate.Converge
  20. wantAids []int64
  21. wantRoomIDs []int64
  22. wantMetaIDs []int64
  23. }{
  24. // TODO: Add test cases.
  25. }
  26. for _, tt := range tests {
  27. Convey(tt.name, t, func() {
  28. gotCardm, gotAids, gotRoomIDs, gotMetaIDs := s.convergeCard(tt.args.c, tt.args.limit, tt.args.ids...)
  29. So(gotCardm, ShouldResemble, tt.wantCardm)
  30. So(gotAids, ShouldResemble, tt.wantAids)
  31. So(gotRoomIDs, ShouldResemble, tt.wantRoomIDs)
  32. So(gotMetaIDs, ShouldResemble, tt.wantMetaIDs)
  33. })
  34. }
  35. }
  36. func TestService_downloadCard(t *testing.T) {
  37. type args struct {
  38. c context.Context
  39. ids []int64
  40. }
  41. tests := []struct {
  42. name string
  43. args args
  44. wantCardm map[int64]*operate.Download
  45. }{
  46. // TODO: Add test cases.
  47. }
  48. for _, tt := range tests {
  49. Convey(tt.name, t, func() {
  50. if gotCardm := s.downloadCard(tt.args.c, tt.args.ids...); !reflect.DeepEqual(gotCardm, tt.wantCardm) {
  51. t.Errorf("Service.downloadCard() = %v, want %v", gotCardm, tt.wantCardm)
  52. }
  53. })
  54. }
  55. }
  56. func TestService_subscribeCard(t *testing.T) {
  57. type args struct {
  58. c context.Context
  59. ids []int64
  60. }
  61. tests := []struct {
  62. name string
  63. args args
  64. wantCardm map[int64]*operate.Follow
  65. wantUpIDs []int64
  66. wantTids []int64
  67. }{
  68. // TODO: Add test cases.
  69. }
  70. for _, tt := range tests {
  71. Convey(tt.name, t, func() {
  72. gotCardm, gotUpIDs, gotTids := s.subscribeCard(tt.args.c, tt.args.ids...)
  73. if !reflect.DeepEqual(gotCardm, tt.wantCardm) {
  74. t.Errorf("Service.subscribeCard() gotCardm = %v, want %v", gotCardm, tt.wantCardm)
  75. }
  76. if !reflect.DeepEqual(gotUpIDs, tt.wantUpIDs) {
  77. t.Errorf("Service.subscribeCard() gotUpIDs = %v, want %v", gotUpIDs, tt.wantUpIDs)
  78. }
  79. if !reflect.DeepEqual(gotTids, tt.wantTids) {
  80. t.Errorf("Service.subscribeCard() gotTids = %v, want %v", gotTids, tt.wantTids)
  81. }
  82. })
  83. }
  84. }
  85. func TestService_channelRcmdCard(t *testing.T) {
  86. type args struct {
  87. c context.Context
  88. ids []int64
  89. }
  90. tests := []struct {
  91. name string
  92. args args
  93. wantCardm map[int64]*operate.Follow
  94. wantUpIDs []int64
  95. wantTids []int64
  96. }{
  97. // TODO: Add test cases.
  98. }
  99. for _, tt := range tests {
  100. Convey(tt.name, t, func() {
  101. gotCardm, gotUpIDs, gotTids := s.channelRcmdCard(tt.args.c, tt.args.ids...)
  102. if !reflect.DeepEqual(gotCardm, tt.wantCardm) {
  103. t.Errorf("Service.channelRcmdCard() gotCardm = %v, want %v", gotCardm, tt.wantCardm)
  104. }
  105. if !reflect.DeepEqual(gotUpIDs, tt.wantUpIDs) {
  106. t.Errorf("Service.channelRcmdCard() gotUpIDs = %v, want %v", gotUpIDs, tt.wantUpIDs)
  107. }
  108. if !reflect.DeepEqual(gotTids, tt.wantTids) {
  109. t.Errorf("Service.channelRcmdCard() gotTids = %v, want %v", gotTids, tt.wantTids)
  110. }
  111. })
  112. }
  113. }
  114. func TestService_liveUpRcmdCard(t *testing.T) {
  115. type args struct {
  116. c context.Context
  117. ids []int64
  118. }
  119. tests := []struct {
  120. name string
  121. args args
  122. wantCardm map[int64][]*live.Card
  123. wantUpIDs []int64
  124. }{
  125. // TODO: Add test cases.
  126. }
  127. for _, tt := range tests {
  128. Convey(tt.name, t, func() {
  129. gotCardm, gotUpIDs := s.liveUpRcmdCard(tt.args.c, tt.args.ids...)
  130. if !reflect.DeepEqual(gotCardm, tt.wantCardm) {
  131. t.Errorf("Service.liveUpRcmdCard() gotCardm = %v, want %v", gotCardm, tt.wantCardm)
  132. }
  133. if !reflect.DeepEqual(gotUpIDs, tt.wantUpIDs) {
  134. t.Errorf("Service.liveUpRcmdCard() gotUpIDs = %v, want %v", gotUpIDs, tt.wantUpIDs)
  135. }
  136. })
  137. }
  138. }