automation 重构期间的配套修改: - browser:订单抓取/密码登录/二维码刷新/stealth 等适配新流程,删 search.go - db:cookies/orders_ext/extras/sessions/users/password/repository 等调整 - xianyu:mtop client、protocol(sign/decrypt/msgpack/cookies)、qrlogin、ws、ua - server:admin/analytics/auth/cookie/helpers/item/item_publish_batch handlers - frontend:App/Dashboard/ItemList/Rules/Sidebar/api/types,删 Keywords/TestPage - auth、notify、webui、go.mod 等 本次会话补充: - cmd/server、cmd/init-admin 改为 // Package main 开头的标准包文档 - .gitignore 加 internal/webui/static/assets/(hash 化构建产物不入库) - internal/webui/static/index.html 重新构建 全量 go build/vet/test + race + 前端 test/build 通过。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
503 B
Go
19 lines
503 B
Go
package logsafe
|
|
|
|
import "testing"
|
|
|
|
func TestRedactionHelpers(t *testing.T) {
|
|
if ID(" secret ") != ID("secret") || len(ID("secret")) != 12 {
|
|
t.Fatal("ID should be trimmed, stable, and short")
|
|
}
|
|
if ID("") != "" {
|
|
t.Fatal("empty ID should remain empty")
|
|
}
|
|
if got := URL("https://example.com/path?q=token#secret"); got != "https://example.com/path" {
|
|
t.Fatalf("URL leaked query or fragment: %q", got)
|
|
}
|
|
if got := URL("not-a-url"); got != "<redacted>" {
|
|
t.Fatalf("invalid URL = %q", got)
|
|
}
|
|
}
|