Handle "naked" CoverArtIDs (IDs of album, mediafiles and playlists)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package slice_test
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/navidrome/navidrome/utils/slice"
|
||||
@@ -13,6 +14,20 @@ func TestSlice(t *testing.T) {
|
||||
RunSpecs(t, "Slice Suite")
|
||||
}
|
||||
|
||||
var _ = Describe("Map", func() {
|
||||
It("returns empty slice for an empty input", func() {
|
||||
mapFunc := func(v int) string { return strconv.Itoa(v * 2) }
|
||||
result := slice.Map([]int{}, mapFunc)
|
||||
Expect(result).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("returns a new slice with elements mapped", func() {
|
||||
mapFunc := func(v int) string { return strconv.Itoa(v * 2) }
|
||||
result := slice.Map([]int{1, 2, 3, 4}, mapFunc)
|
||||
Expect(result).To(ConsistOf("2", "4", "6", "8"))
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("Group", func() {
|
||||
It("returns empty map for an empty input", func() {
|
||||
keyFunc := func(v int) int { return v % 2 }
|
||||
|
||||
Reference in New Issue
Block a user