fadd
This commit is contained in:
35
internal/shared/fadada/corp_service_test.go
Normal file
35
internal/shared/fadada/corp_service_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package fadada
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateEnterpriseAuthRequest(t *testing.T) {
|
||||
err := validateEnterpriseAuthRequest(&EnterpriseAuthRequest{
|
||||
CompanyName: "测试企业有限公司",
|
||||
UnifiedSocialCode: "91110000MA01234567",
|
||||
LegalPersonName: "张三",
|
||||
TransactorName: "张三",
|
||||
TransactorMobile: "13800138000",
|
||||
TransactorID: "110101199001011234",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("expected nil, got %v", err)
|
||||
}
|
||||
|
||||
if err := validateEnterpriseAuthRequest(nil); err == nil {
|
||||
t.Fatal("expected error for nil request")
|
||||
}
|
||||
if err := validateEnterpriseAuthRequest(&EnterpriseAuthRequest{}); err == nil {
|
||||
t.Fatal("expected error for empty request")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodeRedirectURL(t *testing.T) {
|
||||
raw := "http://localhost:5173/profile/certification"
|
||||
encoded := encodeRedirectURL(raw)
|
||||
if encoded == "" || encoded == raw {
|
||||
t.Fatalf("expected url-encoded redirect, got %q", encoded)
|
||||
}
|
||||
if encodeRedirectURL(encoded) != encoded {
|
||||
t.Fatalf("already-encoded url should stay unchanged")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user