123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- package service
- import (
- "reflect"
- "testing"
- )
- func TestChatGroupService_ChatGroupAdd(t *testing.T) {
- type args struct {
- entId int64
- positionId int64
- userIdArr []int64
- appid string
- }
- tests := []struct {
- name string
- args args
- want bool
- }{
- // TODO: Add test cases.
- {
- name: "群组新增",
- args: args{
- entId: 15755,
- positionId: 1204781623,
- userIdArr: []int64{1204841316},
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.ChatGroupAdd(tt.args.entId, tt.args.positionId, tt.args.userIdArr, tt.args.appid); got != tt.want {
- t.Errorf("ChatGroupAdd() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_ChatGroupJoin(t *testing.T) {
- type args struct {
- chatGroupId int64
- positionId int64
- userIdArr []int64
- appid string
- }
- tests := []struct {
- name string
- args args
- want bool
- }{
- // TODO: Add test cases.
- {
- name: "拉人进群",
- args: args{
- chatGroupId: 3,
- positionId: 1204781623,
- userIdArr: []int64{1204841317},
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.ChatGroupJoin(tt.args.chatGroupId, tt.args.positionId, tt.args.userIdArr, tt.args.appid); got != tt.want {
- t.Errorf("ChatGroupJoin() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_ChatGroupList(t *testing.T) {
- type args struct {
- entId int64
- positionId int64
- userName string
- groupName string
- appid string
- }
- tests := []struct {
- name string
- args args
- want []map[string]interface{}
- }{
- // TODO: Add test cases.
- {name: "我的群聊列表默认",
- args: args{
- entId: 15755,
- positionId: 1204781623,
- userName: "张",
- groupName: "",
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.ChatGroupList(tt.args.entId, tt.args.positionId, tt.args.userName, tt.args.groupName, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
- t.Errorf("ChatGroupList() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_ChatGroupPerson(t *testing.T) {
- type args struct {
- ChatGroupId int64
- entId int64
- appid string
- }
- tests := []struct {
- name string
- args args
- want map[string][]map[string]interface{}
- }{
- // TODO: Add test cases.
- {
- name: "群成员",
- args: args{
- ChatGroupId: 3,
- entId: 15755,
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.ChatGroupPerson(tt.args.ChatGroupId, tt.args.entId, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
- t.Errorf("ChatGroupPerson() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_GroupNameUpdate(t *testing.T) {
- type args struct {
- chatGroupId int64
- groupName string
- appid string
- }
- tests := []struct {
- name string
- args args
- want bool
- }{
- // TODO: Add test cases.
- {
- name: "表名修改",
- args: args{
- chatGroupId: 3,
- groupName: "策士",
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.GroupNameUpdate(tt.args.chatGroupId, tt.args.groupName, tt.args.appid); got != tt.want {
- t.Errorf("GroupNameUpdate() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_GroupNoticeAdd(t *testing.T) {
- type args struct {
- chatGroupId int64
- content string
- appid string
- }
- tests := []struct {
- name string
- args args
- want bool
- }{
- // TODO: Add test cases.
- {
- name: "公告新增",
- args: args{
- chatGroupId: 3,
- content: "一起来玩啊",
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.GroupNoticeAdd(tt.args.chatGroupId, tt.args.content, tt.args.appid); got != tt.want {
- t.Errorf("GroupNoticeAdd() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_GroupNoticeGet(t *testing.T) {
- type args struct {
- chatGroupId int64
- appid string
- }
- tests := []struct {
- name string
- args args
- want map[string]interface{}
- }{
- // TODO: Add test cases.
- {
- name: "公告获取",
- args: args{
- chatGroupId: 3,
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.GroupNoticeGet(tt.args.chatGroupId, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
- t.Errorf("GroupNoticeGet() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestChatGroupService_GroupNoticeUpdate(t *testing.T) {
- type args struct {
- groupNoticeId int64
- content string
- appid string
- }
- tests := []struct {
- name string
- args args
- want bool
- }{
- // TODO: Add test cases.
- {
- name: "公告修改",
- args: args{
- groupNoticeId: 1,
- content: "一起来吗qqqqq",
- appid: "10000",
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- b := ChatGroupService{}
- if got := b.GroupNoticeUpdate(tt.args.groupNoticeId, tt.args.content, tt.args.appid); got != tt.want {
- t.Errorf("GroupNoticeUpdate() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestEntPerson(t *testing.T) {
- type args struct {
- entId int64
- isAll bool
- }
- tests := []struct {
- name string
- args args
- want map[string]string
- want1 map[string]string
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- got, got1 := EntPerson(tt.args.entId, tt.args.isAll)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("EntPerson() got = %v, want %v", got, tt.want)
- }
- if !reflect.DeepEqual(got1, tt.want1) {
- t.Errorf("EntPerson() got1 = %v, want %v", got1, tt.want1)
- }
- })
- }
- }
|