chat_group_test.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. package service
  2. import (
  3. "reflect"
  4. "testing"
  5. )
  6. func TestChatGroupService_ChatGroupAdd(t *testing.T) {
  7. type args struct {
  8. entId int64
  9. positionId int64
  10. userIdArr []int64
  11. appid string
  12. }
  13. tests := []struct {
  14. name string
  15. args args
  16. want bool
  17. }{
  18. // TODO: Add test cases.
  19. {
  20. name: "群组新增",
  21. args: args{
  22. entId: 15755,
  23. positionId: 1204781623,
  24. userIdArr: []int64{1204841316},
  25. appid: "10000",
  26. },
  27. },
  28. }
  29. for _, tt := range tests {
  30. t.Run(tt.name, func(t *testing.T) {
  31. b := ChatGroupService{}
  32. if got := b.ChatGroupAdd(tt.args.entId, tt.args.positionId, tt.args.userIdArr, tt.args.appid); got != tt.want {
  33. t.Errorf("ChatGroupAdd() = %v, want %v", got, tt.want)
  34. }
  35. })
  36. }
  37. }
  38. func TestChatGroupService_ChatGroupJoin(t *testing.T) {
  39. type args struct {
  40. chatGroupId int64
  41. positionId int64
  42. userIdArr []int64
  43. appid string
  44. }
  45. tests := []struct {
  46. name string
  47. args args
  48. want bool
  49. }{
  50. // TODO: Add test cases.
  51. {
  52. name: "拉人进群",
  53. args: args{
  54. chatGroupId: 3,
  55. positionId: 1204781623,
  56. userIdArr: []int64{1204841317},
  57. appid: "10000",
  58. },
  59. },
  60. }
  61. for _, tt := range tests {
  62. t.Run(tt.name, func(t *testing.T) {
  63. b := ChatGroupService{}
  64. if got := b.ChatGroupJoin(tt.args.chatGroupId, tt.args.positionId, tt.args.userIdArr, tt.args.appid); got != tt.want {
  65. t.Errorf("ChatGroupJoin() = %v, want %v", got, tt.want)
  66. }
  67. })
  68. }
  69. }
  70. func TestChatGroupService_ChatGroupList(t *testing.T) {
  71. type args struct {
  72. entId int64
  73. positionId int64
  74. userName string
  75. groupName string
  76. appid string
  77. }
  78. tests := []struct {
  79. name string
  80. args args
  81. want []map[string]interface{}
  82. }{
  83. // TODO: Add test cases.
  84. {name: "我的群聊列表默认",
  85. args: args{
  86. entId: 15755,
  87. positionId: 1204781623,
  88. userName: "张",
  89. groupName: "",
  90. appid: "10000",
  91. },
  92. },
  93. }
  94. for _, tt := range tests {
  95. t.Run(tt.name, func(t *testing.T) {
  96. b := ChatGroupService{}
  97. if got := b.ChatGroupList(tt.args.entId, tt.args.positionId, tt.args.userName, tt.args.groupName, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
  98. t.Errorf("ChatGroupList() = %v, want %v", got, tt.want)
  99. }
  100. })
  101. }
  102. }
  103. func TestChatGroupService_ChatGroupPerson(t *testing.T) {
  104. type args struct {
  105. ChatGroupId int64
  106. entId int64
  107. appid string
  108. }
  109. tests := []struct {
  110. name string
  111. args args
  112. want map[string][]map[string]interface{}
  113. }{
  114. // TODO: Add test cases.
  115. {
  116. name: "群成员",
  117. args: args{
  118. ChatGroupId: 3,
  119. entId: 15755,
  120. appid: "10000",
  121. },
  122. },
  123. }
  124. for _, tt := range tests {
  125. t.Run(tt.name, func(t *testing.T) {
  126. b := ChatGroupService{}
  127. if got := b.ChatGroupPerson(tt.args.ChatGroupId, tt.args.entId, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
  128. t.Errorf("ChatGroupPerson() = %v, want %v", got, tt.want)
  129. }
  130. })
  131. }
  132. }
  133. func TestChatGroupService_GroupNameUpdate(t *testing.T) {
  134. type args struct {
  135. chatGroupId int64
  136. groupName string
  137. appid string
  138. }
  139. tests := []struct {
  140. name string
  141. args args
  142. want bool
  143. }{
  144. // TODO: Add test cases.
  145. {
  146. name: "表名修改",
  147. args: args{
  148. chatGroupId: 3,
  149. groupName: "策士",
  150. appid: "10000",
  151. },
  152. },
  153. }
  154. for _, tt := range tests {
  155. t.Run(tt.name, func(t *testing.T) {
  156. b := ChatGroupService{}
  157. if got := b.GroupNameUpdate(tt.args.chatGroupId, tt.args.groupName, tt.args.appid); got != tt.want {
  158. t.Errorf("GroupNameUpdate() = %v, want %v", got, tt.want)
  159. }
  160. })
  161. }
  162. }
  163. func TestChatGroupService_GroupNoticeAdd(t *testing.T) {
  164. type args struct {
  165. chatGroupId int64
  166. content string
  167. appid string
  168. }
  169. tests := []struct {
  170. name string
  171. args args
  172. want bool
  173. }{
  174. // TODO: Add test cases.
  175. {
  176. name: "公告新增",
  177. args: args{
  178. chatGroupId: 3,
  179. content: "一起来玩啊",
  180. appid: "10000",
  181. },
  182. },
  183. }
  184. for _, tt := range tests {
  185. t.Run(tt.name, func(t *testing.T) {
  186. b := ChatGroupService{}
  187. if got := b.GroupNoticeAdd(tt.args.chatGroupId, tt.args.content, tt.args.appid); got != tt.want {
  188. t.Errorf("GroupNoticeAdd() = %v, want %v", got, tt.want)
  189. }
  190. })
  191. }
  192. }
  193. func TestChatGroupService_GroupNoticeGet(t *testing.T) {
  194. type args struct {
  195. chatGroupId int64
  196. appid string
  197. }
  198. tests := []struct {
  199. name string
  200. args args
  201. want map[string]interface{}
  202. }{
  203. // TODO: Add test cases.
  204. {
  205. name: "公告获取",
  206. args: args{
  207. chatGroupId: 3,
  208. appid: "10000",
  209. },
  210. },
  211. }
  212. for _, tt := range tests {
  213. t.Run(tt.name, func(t *testing.T) {
  214. b := ChatGroupService{}
  215. if got := b.GroupNoticeGet(tt.args.chatGroupId, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
  216. t.Errorf("GroupNoticeGet() = %v, want %v", got, tt.want)
  217. }
  218. })
  219. }
  220. }
  221. func TestChatGroupService_GroupNoticeUpdate(t *testing.T) {
  222. type args struct {
  223. groupNoticeId int64
  224. content string
  225. appid string
  226. }
  227. tests := []struct {
  228. name string
  229. args args
  230. want bool
  231. }{
  232. // TODO: Add test cases.
  233. {
  234. name: "公告修改",
  235. args: args{
  236. groupNoticeId: 1,
  237. content: "一起来吗qqqqq",
  238. appid: "10000",
  239. },
  240. },
  241. }
  242. for _, tt := range tests {
  243. t.Run(tt.name, func(t *testing.T) {
  244. b := ChatGroupService{}
  245. if got := b.GroupNoticeUpdate(tt.args.groupNoticeId, tt.args.content, tt.args.appid); got != tt.want {
  246. t.Errorf("GroupNoticeUpdate() = %v, want %v", got, tt.want)
  247. }
  248. })
  249. }
  250. }
  251. func TestEntPerson(t *testing.T) {
  252. type args struct {
  253. entId int64
  254. isAll bool
  255. }
  256. tests := []struct {
  257. name string
  258. args args
  259. want map[string]string
  260. want1 map[string]string
  261. }{
  262. // TODO: Add test cases.
  263. }
  264. for _, tt := range tests {
  265. t.Run(tt.name, func(t *testing.T) {
  266. got, got1 := EntPerson(tt.args.entId, tt.args.isAll)
  267. if !reflect.DeepEqual(got, tt.want) {
  268. t.Errorf("EntPerson() got = %v, want %v", got, tt.want)
  269. }
  270. if !reflect.DeepEqual(got1, tt.want1) {
  271. t.Errorf("EntPerson() got1 = %v, want %v", got1, tt.want1)
  272. }
  273. })
  274. }
  275. }