mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-10 23:36:37 +08:00
refactor: split modules and harden scraping workflows
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ShukeBta/MediaStationGo/internal/model"
|
||||
)
|
||||
|
||||
func TestMediaSeriesKeyCollapsesNestedSpecialFolders(t *testing.T) {
|
||||
main := model.Media{
|
||||
LibraryID: "lib-tv",
|
||||
Path: `cloud://openlist/动漫/国漫/示例剧/Season 01/示例剧.S01E01.mkv`,
|
||||
SeasonNum: 1,
|
||||
EpisodeNum: 1,
|
||||
}
|
||||
special := model.Media{
|
||||
LibraryID: "lib-tv",
|
||||
Path: `cloud://openlist/动漫/国漫/示例剧/Extras/Season 01/示例剧.SP01.mkv`,
|
||||
}
|
||||
|
||||
if got, want := mediaSeriesKey(special), mediaSeriesKey(main); got != want {
|
||||
t.Fatalf("special key=%q, want main key=%q", got, want)
|
||||
}
|
||||
|
||||
cards := groupMediaSeriesCards([]model.Media{main, special})
|
||||
if len(cards) != 1 || cards[0].Count != 2 {
|
||||
t.Fatalf("cards=%#v, want one merged series card with two items", cards)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user