🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
test: enable artwork tests on Windows (#5416)
Deluan Quintãoa756cad1dc0a
diff --git a/core/artwork/artwork_internal_test.go b/core/artwork/artwork_internal_test.goindex 12a7085e8..7a48fa620 100644--- a/core/artwork/artwork_internal_test.go+++ b/core/artwork/artwork_internal_test.go@@ -41,6 +41,7 @@ var _ = Describe("Artwork", func() {MockedTranscoding: &tests.MockTranscodingRepo{},MockedFolder: folderRepo,}+ // Paths use forward slashes because the scanner stores fs.FS-relative paths in the DB.alOnlyEmbed = model.Album{ID: "222", Name: "Only embed", EmbedArtPath: "tests/fixtures/artist/an-album/test.mp3", FolderIDs: []string{"f1"}}alEmbedNotFound = model.Album{ID: "333", Name: "Embed not found", EmbedArtPath: "tests/fixtures/NON_EXISTENT.mp3", FolderIDs: []string{"f1"}}alOnlyExternal = model.Album{ID: "444", Name: "Only external", FolderIDs: []string{"f1"}, Discs: model.Discs{1: "", 2: ""}}@@ -80,12 +81,11 @@ var _ = Describe("Artwork", func() {})})It("returns embed cover", func() {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")aw, err := newAlbumArtworkReader(ctx, aw, alOnlyEmbed.CoverArtID(), nil)Expect(err).ToNot(HaveOccurred())_, path, err := aw.Reader(ctx)Expect(err).ToNot(HaveOccurred())- Expect(path).To(Equal("tests/fixtures/artist/an-album/test.mp3"))+ Expect(path).To(Equal(filepath.FromSlash("tests/fixtures/artist/an-album/test.mp3")))})It("returns ErrUnavailable if embed path is not available", func() {ffmpeg.Error = errors.New("not available")@@ -104,7 +104,6 @@ var _ = Describe("Artwork", func() {})})It("returns external cover", func() {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")folderRepo.result = []model.Folder{{Path: "tests/fixtures/artist/an-album",ImageFiles: []string{"front.png"},@@ -113,7 +112,7 @@ var _ = Describe("Artwork", func() {Expect(err).ToNot(HaveOccurred())_, path, err := aw.Reader(ctx)Expect(err).ToNot(HaveOccurred())- Expect(path).To(Equal("tests/fixtures/artist/an-album/front.png"))+ Expect(path).To(Equal(filepath.FromSlash("tests/fixtures/artist/an-album/front.png")))})It("returns ErrUnavailable if external file is not available", func() {folderRepo.result = []model.Folder{}@@ -135,13 +134,12 @@ var _ = Describe("Artwork", func() {})DescribeTable("CoverArtPriority",func(priority string, expected string) {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")conf.Server.CoverArtPriority = priorityaw, err := newAlbumArtworkReader(ctx, aw, alMultipleCovers.CoverArtID(), nil)Expect(err).ToNot(HaveOccurred())_, path, err := aw.Reader(ctx)Expect(err).ToNot(HaveOccurred())- Expect(path).To(Equal(expected))+ Expect(path).To(Equal(filepath.FromSlash(expected)))},Entry(nil, " folder.* , cover.*,embedded,front.*", "tests/fixtures/artist/an-album/cover.jpg"),Entry(nil, "front.* , cover.*, embedded ,folder.*", "tests/fixtures/artist/an-album/front.png"),@@ -213,13 +211,12 @@ var _ = Describe("Artwork", func() {})DescribeTable("ArtistArtPriority",func(priority string, expected string) {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")conf.Server.ArtistArtPriority = priorityaw, err := newArtistArtworkReader(ctx, aw, arMultipleCovers.CoverArtID(), nil)Expect(err).ToNot(HaveOccurred())_, path, err := aw.Reader(ctx)Expect(err).ToNot(HaveOccurred())- Expect(path).To(Equal(expected))+ Expect(path).To(Equal(filepath.FromSlash(expected)))},Entry(nil, " folder.* , artist.*,album/artist.*", "tests/fixtures/artist/artist.jpg"),Entry(nil, "album/artist.*, folder.*,artist.*", "tests/fixtures/artist/an-album/artist.png"),@@ -251,22 +248,20 @@ var _ = Describe("Artwork", func() {})})It("returns embed cover", func() {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")aw, err := newMediafileArtworkReader(ctx, aw, mfWithEmbed.CoverArtID())Expect(err).ToNot(HaveOccurred())_, path, err := aw.Reader(ctx)Expect(err).ToNot(HaveOccurred())- Expect(path).To(Equal("tests/fixtures/test.mp3"))+ Expect(path).To(Equal(filepath.FromSlash("tests/fixtures/test.mp3")))})It("returns embed cover if successfully extracted by ffmpeg", func() {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")aw, err := newMediafileArtworkReader(ctx, aw, mfCorruptedCover.CoverArtID())Expect(err).ToNot(HaveOccurred())r, path, err := aw.Reader(ctx)Expect(err).ToNot(HaveOccurred())data, _ := io.ReadAll(r)Expect(data).ToNot(BeEmpty())- Expect(path).To(Equal("tests/fixtures/test.ogg"))+ Expect(path).To(Equal(filepath.FromSlash("tests/fixtures/test.ogg")))})It("returns album cover if cannot read embed artwork", func() {// Force fromTag to faildiff --git a/core/artwork/reader_artist_test.go b/core/artwork/reader_artist_test.goindex 220c7554f..33dc6ed57 100644--- a/core/artwork/reader_artist_test.go+++ b/core/artwork/reader_artist_test.go@@ -12,7 +12,6 @@ import ("github.com/navidrome/navidrome/conf/configtest""github.com/navidrome/navidrome/core""github.com/navidrome/navidrome/model"- "github.com/navidrome/navidrome/tests". "github.com/onsi/ginkgo/v2". "github.com/onsi/gomega")@@ -62,13 +61,12 @@ var _ = Describe("artistArtworkReader", func() {When("artist has only one album", func() {It("returns the parent folder", func() {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")paths = []string{filepath.FromSlash("/music/artist/album1"),}folder, upd, err := loadArtistFolder(ctx, fds, albums, paths)Expect(err).ToNot(HaveOccurred())- Expect(folder).To(Equal("/music/artist"))+ Expect(folder).To(Equal(filepath.FromSlash("/music/artist")))Expect(upd).To(Equal(expectedUpdTime))})})@@ -88,14 +86,13 @@ var _ = Describe("artistArtworkReader", func() {When("the album paths contain same prefix", func() {It("returns the common prefix", func() {- tests.SkipOnWindows("artwork path handling (#TBD-path-sep-artwork)")paths = []string{filepath.FromSlash("/music/artist/album1"),filepath.FromSlash("/music/artist/album2"),}folder, upd, err := loadArtistFolder(ctx, fds, albums, paths)Expect(err).ToNot(HaveOccurred())- Expect(folder).To(Equal("/music/artist"))+ Expect(folder).To(Equal(filepath.FromSlash("/music/artist")))Expect(upd).To(Equal(expectedUpdTime))})})