fix: align business pages and detail drawers with prototype
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package business
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"kra/internal/biz/business"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type channelPortraitTransportFake struct{ result *business.ChannelPortrait }
|
||||
|
||||
func (f channelPortraitTransportFake) Portrait(context.Context, business.ChannelKey, string) (*business.ChannelPortrait, error) {
|
||||
return f.result, nil
|
||||
}
|
||||
|
||||
func TestChannelPortraitKeepsContactAndCooperationStatusSeparateFromAudit(t *testing.T) {
|
||||
level, auditStatus, days := 1, 1, 7
|
||||
for _, sample := range []struct {
|
||||
status int
|
||||
label string
|
||||
}{{0, "正常"}, {-1, "锁定"}, {-2, "解除合作"}} {
|
||||
channel := &business.Channel{ChannelKey: business.ChannelKey{SourceDB: "lx", ID: 100}, Account: "渠道账号", Level: &level, Status: &auditStatus, LockStatus: &sample.status, Phone: "13812345678", SettlementDays: &days, BusinessPath: []string{"一级商务", "所属商务"}}
|
||||
service := &ChannelPortraitService{uc: channelPortraitTransportFake{&business.ChannelPortrait{Basic: &business.ChannelPortraitBasic{Channel: channel}}}}
|
||||
result, err := service.Portrait(context.Background(), &dto.ChannelPortraitQuery{SourceDB: "lx", PromoteID: 100})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b := result.Basic
|
||||
if b.LockStatusLabel != sample.label || b.StatusLabel != "正常" || b.Phone != channel.Phone || b.SettlementDays == nil || *b.SettlementDays != 7 || b.BusierDisplayName != "一级商务→所属商务" || b.ParentPromoteName == nil || *b.ParentPromoteName != "所属商务" {
|
||||
t.Fatalf("portrait metadata or status mismatch: %+v", b)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user