新增配送点资料只读卡片
This commit is contained in:
33
backend/api/internal/logic/delivery/profile_test.go
Normal file
33
backend/api/internal/logic/delivery/profile_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// 功能描述:验证配送点资料响应仅暴露本点只读展示所需字段。版本:v1.0.0。
|
||||
package delivery
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.apinb.com/heqiapp/platforms/backend/api/internal/models"
|
||||
)
|
||||
|
||||
// TestBuildDeliveryProfileView 验证资料响应包含所属气站名称且保持公开标识。
|
||||
func TestBuildDeliveryProfileView(t *testing.T) {
|
||||
now := time.Date(2026, time.August, 22, 10, 30, 0, 0, time.UTC)
|
||||
point := models.DeliveryBasic{
|
||||
Entity: models.Entity{ID: 19, Identity: "delivery-identity", Status: 1, CreatedAt: now, UpdatedAt: now},
|
||||
DeliveryCode: "D-001",
|
||||
Name: "测试配送点",
|
||||
Principal: "负责人",
|
||||
Address: "测试地址",
|
||||
}
|
||||
station := models.GasBasic{
|
||||
Entity: models.Entity{ID: 7, Identity: "gas-identity"},
|
||||
Name: "测试气站",
|
||||
}
|
||||
|
||||
view := buildDeliveryProfileView(point, station)
|
||||
if view.ID != point.ID || view.Identity != point.Identity || view.GasBasicIdentity != station.Identity {
|
||||
t.Fatalf("资料标识映射错误:%#v", view)
|
||||
}
|
||||
if view.GasBasicName != station.Name || view.Name != point.Name || view.Status != point.Status {
|
||||
t.Fatalf("资料展示字段映射错误:%#v", view)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user