package service import ( "app.yhyue.com/moapp/jybase/common" "app.yhyue.com/moapp/jybase/encrypt" "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity" "fmt" "testing" ) // 认领 func TestEntClaimService_Claim(t *testing.T) { type args struct { data *entity.EntClaim } tests := []struct { name string args args want bool }{ {"认领医疗机构", args{ data: &entity.EntClaim{UserId: 1, AppId: "10000", EntId: "1122", EntName: "877", Status: entity.StatusClaimed, Type: entity.TypeInstitution, Address: "2223", EstablishDate: "2022", RegisterCapital: "dd", Phone: "18238182402", CreateTime: "2022-08-19 15:08:00"}, }, true, }, {"认领医疗机构-2", args{ data: &entity.EntClaim{UserId: 2, AppId: "10000", EntId: "7", EntName: "8757", Status: entity.StatusClaimed, Type: entity.TypeDistributor, Address: "2223", EstablishDate: "2022", RegisterCapital: "dd", Phone: "18238182402", CreateTime: "2022-08-19 15:08:00"}, }, true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := EntClaimSrv.Claim(tt.args.data); got != tt.want { t.Errorf("Claim() = %v, want %v", got, tt.want) } }) } } // 我认领的经销商的列表 func TestEntClaimService_DistributorList(t *testing.T) { type args struct { userId int appId string page int pageSize int } tests := []struct { name string args args want *[]map[string]interface{} }{ { name: "我认领的经销商", args: args{userId: 1, appId: "10000", page: 0, pageSize: 10}, want: nil, }, { name: "我认领的经销商-2", args: args{userId: 8, appId: "10000", page: 0, pageSize: 10}, want: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, total := EntClaimSrv.DistributorList(tt.args.userId, tt.args.appId, tt.args.page, tt.args.pageSize) fmt.Println(got, total) t.Log(got, total) }) } } // 我认领的机构列表 func TestEntClaimService_InstitutionList(t *testing.T) { type args struct { userId int appId string page int pageSize int } tests := []struct { name string args args want *[]map[string]interface{} }{ { name: "我认领的医疗机构", args: args{userId: 1, appId: "10000", page: 0, pageSize: 10}, want: nil, }, { name: "我认领的医疗机构-2", args: args{userId: 3, appId: "10000", page: 0, pageSize: 10}, want: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, total := EntClaimSrv.InstitutionList(tt.args.userId, tt.args.appId, tt.args.page, tt.args.pageSize) t.Log(got, total) }) } } // 是否认领 func TestEntClaimService_IsClaimed(t *testing.T) { type args struct { userId int appId string entId string typeCode int } tests := []struct { name string args args want bool }{ {"是否认领", args{userId: 1, typeCode: 1, entId: "1", appId: "10000"}, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := EntClaimSrv.IsClaimed(tt.args.userId, tt.args.appId, tt.args.entId, tt.args.typeCode); got != tt.want { t.Errorf("IsClaimed() = %v, want %v", got, tt.want) } }) } } // 取消认领 func TestEntClaimService_Unclaimed(t *testing.T) { type args struct { id int userId int } tests := []struct { name string args args want bool }{ { "取消认领", args{userId: 1, id: 2}, true, }, { "取消认领-2", args{userId: 100, id: 2}, false, }, { "取消认领-3", args{userId: 100, id: 900009}, false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := EntClaimSrv.Unclaimed(tt.args.id, tt.args.userId); got != tt.want { t.Errorf("Unclaimed() = %v, want %v", got, tt.want) } }) } } // 获取企业基本信息 func TestEntClaimService_GetInstitution(t *testing.T) { type args struct { id string } tests := []struct { name string args args want *map[string]interface{} }{ { "获取企业基本信息", args{id: ""}, nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := EntClaimSrv.GetInstitution(tt.args.id) t.Log(got) }) } } func TestName(t *testing.T) { s := encrypt.SE.Encode2Hex(common.ObjToString("90009")) fmt.Print(s) }