Files
MeBox/internal/handler/cloud_test.go
T
ShukeBta 23d1fbfddb fix cloud library scale and playback compatibility
Root cause: display-only cloud library filtering was reused by scan jobs, merged cloud mounts could be skipped, and OpenList listing relied on WebDAV/first-page behavior that could cap huge directories around 100 items. Cloud scans also let new items consume probe budget before existing rows with missing track/artwork metadata.\n\nChanges:\n- split display filtering from scannable cloud filtering so merged cloud mounts still scan\n- add OpenList API pagination with WebDAV fallback\n- prioritize existing cloud media missing metadata before new imports\n- restrict automatic cloud sync to one successful 19:00-21:00 daily window and keep manual scan immediate\n- disable startup cloud full-scan by default, with an explicit opt-in setting\n- improve Emby/cloud playback compatibility and cache/search/test coverage from the continued work
2026-06-11 18:31:01 +08:00

27 lines
897 B
Go

package handler
import "testing"
func TestCloudMountLibraryNameDefaultsToDirectoryBaseName(t *testing.T) {
tests := []struct {
name string
provider string
dir string
displayDir string
want string
}{
{name: "openlist directory", provider: "openlist", dir: "/国产剧", displayDir: "/国产剧", want: "国产剧"},
{name: "nested directory", provider: "openlist", dir: "id-123", displayDir: "剧集/国产剧", want: "国产剧"},
{name: "provider root", provider: "openlist", dir: "", displayDir: "", want: "OpenList"},
{name: "115 root id", provider: "cloud115", dir: "0", displayDir: "", want: "115 网盘"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := cloudMountLibraryName(tt.provider, tt.dir, tt.displayDir); got != tt.want {
t.Fatalf("cloudMountLibraryName() = %q, want %q", got, tt.want)
}
})
}
}