mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
Update getIndexes tests for folder-based browsing, add FolderBrowsing=false fallback test
Signed-off-by: Patrik Wallström <pawal@amplitut.de>
This commit is contained in:
parent
cba0cfe569
commit
fd61e7e73f
@ -2,6 +2,7 @@ package e2e
|
||||
|
||||
import (
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/navidrome/navidrome/conf"
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/server/subsonic/responses"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
@ -26,7 +27,7 @@ var _ = Describe("Browsing Endpoints", func() {
|
||||
})
|
||||
|
||||
Describe("getIndexes", func() {
|
||||
It("returns artist indexes", func() {
|
||||
It("returns folder indexes by default", func() {
|
||||
resp := doReq("getIndexes")
|
||||
|
||||
Expect(resp.Status).To(Equal(responses.StatusOK))
|
||||
@ -34,16 +35,31 @@ var _ = Describe("Browsing Endpoints", func() {
|
||||
Expect(resp.Indexes.Index).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("includes all artists across indexes", func() {
|
||||
It("includes top-level folders grouped by first letter", func() {
|
||||
resp := doReq("getIndexes")
|
||||
|
||||
var allArtistNames []string
|
||||
var allNames []string
|
||||
for _, idx := range resp.Indexes.Index {
|
||||
for _, a := range idx.Artists {
|
||||
allArtistNames = append(allArtistNames, a.Name)
|
||||
allNames = append(allNames, a.Name)
|
||||
}
|
||||
}
|
||||
Expect(allArtistNames).To(ContainElements("The Beatles", "Led Zeppelin", "Miles Davis", "Various"))
|
||||
Expect(allNames).To(ContainElements("Jazz", "Pop", "Rock", "CJK"))
|
||||
})
|
||||
|
||||
It("falls back to artist index when FolderBrowsing is disabled", func() {
|
||||
conf.Server.Subsonic.FolderBrowsing = false
|
||||
DeferCleanup(func() { conf.Server.Subsonic.FolderBrowsing = true })
|
||||
|
||||
resp := doReq("getIndexes")
|
||||
|
||||
var allNames []string
|
||||
for _, idx := range resp.Indexes.Index {
|
||||
for _, a := range idx.Artists {
|
||||
allNames = append(allNames, a.Name)
|
||||
}
|
||||
}
|
||||
Expect(allNames).To(ContainElements("The Beatles", "Led Zeppelin", "Miles Davis", "Various"))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user