Files
platforms/backend/api/internal/logic/delivery/resource_contract_test.go
2026-08-22 23:24:12 +08:00

27 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 功能描述验证配送端资源搜索契约与页面能力保持一致。版本v1.0.0。
package delivery
import "testing"
// TestExpectedResourcesExposeSearchContract 验证有效搜索与隐藏搜索的资源边界。
func TestExpectedResourcesExposeSearchContract(t *testing.T) {
resources := ExpectedResources()
byName := make(map[string]ResourceContract, len(resources))
for _, resource := range resources {
byName[resource.Name] = resource
}
credential := byName["staff_credential"].SearchFields
if len(credential) != 2 || credential[0].Key != "credential_type" || credential[1].Key != "credential_no" {
t.Fatalf("人员资质搜索契约不完整:%#v", credential)
}
for _, name := range []string{"delivery_profile", "user_address", "wallet_bank"} {
if len(byName[name].SearchFields) != 0 {
t.Fatalf("%s 不应显示无效搜索:%#v", name, byName[name].SearchFields)
}
}
channel := byName["payment_order"].SearchFields[2]
if channel.Kind != "enum" || len(channel.Values) != 3 {
t.Fatalf("支付渠道中英文搜索契约不完整:%#v", channel)
}
}