This commit is contained in:
2026-07-21 15:53:29 +08:00
parent 024b6614ba
commit c943f575d5
40 changed files with 5362 additions and 275 deletions

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