mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-05 21:06:38 +08:00
fix: 修复 beta CI 失败的两个平台/网络敏感测试
- TestSanitizePathWithSpecialChars:Windows 盘符断言按 runtime.GOOS 分支 (Linux 下反斜杠统一为分隔符,期望 D/test/...) - TestEnrichOneAdultScrapesArtwork:AdultProvider 改用 RoundTripper 全量 mock,拦截所有外网请求(CI 环境可达 javdb/dmm 时会把真实封面写入 断言导致失败);断言放宽为封面路径后缀
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -291,8 +292,15 @@ func TestSanitizePathWithSpecialChars(t *testing.T) {
|
||||
}
|
||||
|
||||
// Test sanitizeLocalPath - Windows Drive
|
||||
// sanitizeLocalPath 的盘符处理是平台相关的:Windows 保留 `D:\` 前缀,
|
||||
// Linux 把反斜杠统一当作分隔符(结果等价于 D:/test/...)。
|
||||
localWin := `D:\test\动漫\数码宝贝:拯救者\poster.jpg`
|
||||
wantLocalWin := filepath.Join(`D:\`, "test", "动漫", "数码宝贝 拯救者", "poster.jpg")
|
||||
var wantLocalWin string
|
||||
if runtime.GOOS == "windows" {
|
||||
wantLocalWin = filepath.Join(`D:\`, "test", "动漫", "数码宝贝 拯救者", "poster.jpg")
|
||||
} else {
|
||||
wantLocalWin = filepath.Join("D", "test", "动漫", "数码宝贝 拯救者", "poster.jpg")
|
||||
}
|
||||
if got := sanitizeLocalPath(localWin); got != wantLocalWin {
|
||||
t.Errorf("sanitizeLocalPath(%q) = %q, want %q", localWin, got, wantLocalWin)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user