新增配送点资料只读卡片

This commit is contained in:
czl231
2026-08-22 19:49:28 +08:00
parent 79749685ee
commit da0185d1aa
9 changed files with 401 additions and 4 deletions

View 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)
}
}