ai_scheduler/internal/services/advice/client_test.go

40 lines
2.1 KiB
Go

package advice
import (
"context"
"testing"
)
func Test_ClientAdd(t *testing.T) {
reqBody := `{"projectId":1,"AdvicerId":1,"personalInfo":{"name":"杜先生","gender":"男","location":"","isFirstHome":false,"familyOrganize":"夫妻+2孩"},"purchasePurpose":{"primaryPurpose":"改善居住条件","secondaryPurpose":"资产保值","decisionMakers":"夫妻双方"},"coreDemands":{"totalBudget":"450-500万","preferredLayout":"140㎡四房三卫","coreAppeal":"户型实用、景观好、社区品质高"},"concerns":["小区小是否保值","价格是否有优惠","开发商交付能力"],"decisionProfile":["注重户型实用性和景观","关注社区品质和后期保值","对价格敏感,希望拿到优惠"]}`
Run(context.Background(), []byte(reqBody))
err := client.Add(fiberCtx)
t.Log(err)
}
func Test_ClientUpdate(t *testing.T) {
reqBody := `{"id":"698199fa0c5f4ae098e009ab","projectId":1,"AdvicerId":1,"personalInfo":{"name":"唐先生1","gender":"男","location":"成都北门","isFirstHome":false,"familyOrganize":"夫妻+1孩+父母同住"},"purchasePurpose":{"primaryPurpose":"改善居住条件","secondaryPurpose":"资产保值,方便子女上学","decisionMakers":"夫妻双方"},"coreDemands":{"totalBudget":"350-400万","preferredLayout":"118㎡四房三卫双套房","coreAppeal":"在预算内满足家庭居住功能,确保房产保值,临近学校"},"concerns":["总价超预算风险","板块保值能力","小区小是否影响居住体验","开发商资金实力"],"decisionProfile":["预算导向,严格控制总价","重点关注户型功能性和实用性","需要对比板块发展潜力","对开发商交付能力有顾虑"]}`
Run(context.Background(), []byte(reqBody))
err := client.Update(fiberCtx)
t.Log(err)
}
func Test_ClientList(t *testing.T) {
reqBody := `{"projectId":1}`
Run(context.Background(), []byte(reqBody))
err := client.List(fiberCtx)
t.Log(err)
}
func Test_ClientDel(t *testing.T) {
reqBody := `{"id":"698056073059550befc4f0da"}`
Run(context.Background(), []byte(reqBody))
err := advicer.AdvicerVersionDel(fiberCtx)
t.Log(err)
}
var (
client *ClientService
)