mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 04:57:37 +03:00
Restore MediaRetrievalController tests
This commit is contained in:
parent
0c3edc0279
commit
b1e58352e9
5 changed files with 88 additions and 141 deletions
43
utils/index_group_parser_test.go
Normal file
43
utils/index_group_parser_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseIndexGroup(t *testing.T) {
|
||||
|
||||
Convey("Two simple entries", t, func() {
|
||||
parsed := ParseIndexGroups("A The")
|
||||
|
||||
So(parsed, ShouldContainKey, "A")
|
||||
So(parsed["A"], ShouldEqual, "A")
|
||||
|
||||
So(parsed, ShouldContainKey, "The")
|
||||
So(parsed["The"], ShouldEqual, "The")
|
||||
})
|
||||
|
||||
Convey("An entry with a group", t, func() {
|
||||
parsed := ParseIndexGroups("A-C(ABC) Z")
|
||||
|
||||
So(parsed, ShouldContainKey, "A")
|
||||
So(parsed["A"], ShouldEqual, "A-C")
|
||||
So(parsed, ShouldContainKey, "B")
|
||||
So(parsed["B"], ShouldEqual, "A-C")
|
||||
So(parsed, ShouldContainKey, "C")
|
||||
So(parsed["C"], ShouldEqual, "A-C")
|
||||
|
||||
So(parsed["Z"], ShouldEqual, "Z")
|
||||
|
||||
})
|
||||
Convey("Correctly parses UTF-8", t, func() {
|
||||
parsed := ParseIndexGroups("UTF8(宇A海)")
|
||||
|
||||
So(parsed, ShouldContainKey, "宇")
|
||||
So(parsed["宇"], ShouldEqual, "UTF8")
|
||||
So(parsed, ShouldContainKey, "A")
|
||||
So(parsed["A"], ShouldEqual, "UTF8")
|
||||
So(parsed, ShouldContainKey, "海")
|
||||
So(parsed["海"], ShouldEqual, "UTF8")
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue