完善配送端资源搜索与资质导航
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// 功能描述:验证配送端资源搜索契约与页面能力保持一致。版本: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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user