mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-10 15:26:38 +08:00
初始化
初始化项目
This commit is contained in:
@@ -1,14 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ShukeBta/MediaStationGo/internal/config"
|
||||
"github.com/ShukeBta/MediaStationGo/internal/model"
|
||||
"github.com/ShukeBta/MediaStationGo/internal/repository"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
func TestClassifyMediaCategoryMatchesSmartRules(t *testing.T) {
|
||||
tests := []struct {
|
||||
@@ -438,26 +430,3 @@ func TestNormalizeMediaTypeDoesNotTreatReleaseTokensAsTV(t *testing.T) {
|
||||
t.Fatalf("standalone tv path token = %q, want tv", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubscriptionResolveClassifiedSavePath(t *testing.T) {
|
||||
db := newServiceTestDB(t, &model.Setting{})
|
||||
repos := repository.New(db)
|
||||
if err := repos.Setting.Set(t.Context(), "organizer.smart_classify", "true"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := repos.Setting.Set(t.Context(), "qbittorrent.savepath", `D:\Downloads`); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
svc := NewSubscriptionService(&config.Config{}, zap.NewNop(), repos, nil, nil, nil)
|
||||
sub := &model.Subscription{Name: "声生不息 自动订阅", MediaType: "tv"}
|
||||
|
||||
mediaType, category := svc.classifySubscriptionItem(t.Context(), sub, "声生不息 S01E01", "综艺")
|
||||
if mediaType != "tv" || category != "综艺" {
|
||||
t.Fatalf("classification = %q/%q, want tv/综艺", mediaType, category)
|
||||
}
|
||||
got := svc.resolveSubscriptionSavePath(t.Context(), sub, mediaType, category)
|
||||
want := `D:\Downloads\综艺`
|
||||
if got != want {
|
||||
t.Fatalf("save path = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user