From c4104499a9781de05ba29b274db139bd6aa4b5b6 Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 19 Jun 2026 13:59:52 -0400 Subject: [PATCH] test(lyrics): strengthen e2e lyrics baseline (lang assertions, rename helper) Rename the local helper `main` to `firstLyric` to avoid collision with the reserved-feeling built-in name. Add `Lang` assertions to both embedded and sidecar DescribeTable entries, locking the current observed values: "xxx" (ISO 639-2 "no language specified") for all embedded and LRC/SRT sidecars, and "eng" for the YAML sidecar (which explicitly sets `language: eng`). --- server/e2e/subsonic_lyrics_test.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/server/e2e/subsonic_lyrics_test.go b/server/e2e/subsonic_lyrics_test.go index adf09a9a1..ca4dd7195 100644 --- a/server/e2e/subsonic_lyrics_test.go +++ b/server/e2e/subsonic_lyrics_test.go @@ -20,8 +20,8 @@ var _ = Describe("Lyrics endpoints", func() { return resp.SearchResult3.Song[0].Id } - // main extracts the first StructuredLyric from a LyricsList response. - main := func(list *responses.LyricsList) responses.StructuredLyric { + // firstLyric extracts the first StructuredLyric from a LyricsList response. + firstLyric := func(list *responses.LyricsList) responses.StructuredLyric { Expect(list).ToNot(BeNil()) Expect(list.StructuredLyrics).ToNot(BeEmpty()) return list.StructuredLyrics[0] @@ -29,31 +29,35 @@ var _ = Describe("Lyrics endpoints", func() { Describe("getLyricsBySongId (v2 structured)", func() { DescribeTable("returns structured lyrics for embedded formats", - func(title string, wantSynced bool, wantFirstLine string) { + func(title string, wantSynced bool, wantFirstLine, wantLang string) { resp := doReq("getLyricsBySongId", "id", songID(title)) Expect(resp.Status).To(Equal("ok")) - got := main(resp.LyricsList) + got := firstLyric(resp.LyricsList) Expect(got.Synced).To(Equal(wantSynced)) + Expect(got.Lang).To(Equal(wantLang)) Expect(got.Line).ToNot(BeEmpty()) Expect(got.Line[0].Value).To(Equal(wantFirstLine)) }, - Entry("synced LRC", "Embedded Synced LRC", true, "embedded lrc line one"), - Entry("plain text", "Embedded Plain", false, "plain embedded line one"), - Entry("TTML", "Embedded TTML", true, "embedded ttml line"), + // "xxx" is the ISO 639-2 code for "no language specified" + Entry("synced LRC", "Embedded Synced LRC", true, "embedded lrc line one", "xxx"), + Entry("plain text", "Embedded Plain", false, "plain embedded line one", "xxx"), + Entry("TTML", "Embedded TTML", true, "embedded ttml line", "xxx"), ) DescribeTable("returns structured lyrics for sidecar formats", - func(title string, wantSynced bool, wantFirstLine string) { + func(title string, wantSynced bool, wantFirstLine, wantLang string) { resp := doReq("getLyricsBySongId", "id", songID(title)) Expect(resp.Status).To(Equal("ok")) - got := main(resp.LyricsList) + got := firstLyric(resp.LyricsList) Expect(got.Synced).To(Equal(wantSynced)) + Expect(got.Lang).To(Equal(wantLang)) Expect(got.Line).ToNot(BeEmpty()) Expect(got.Line[0].Value).To(Equal(wantFirstLine)) }, - Entry("LRC sidecar", "Sidecar LRC", true, "sidecar lrc line"), - Entry("SRT sidecar", "Sidecar SRT", true, "sidecar srt line"), - Entry("YAML sidecar", "Sidecar YAML", true, "sidecar yaml line"), + Entry("LRC sidecar", "Sidecar LRC", true, "sidecar lrc line", "xxx"), + Entry("SRT sidecar", "Sidecar SRT", true, "sidecar srt line", "xxx"), + // YAML sidecar fixture sets "language: eng"; verify Navidrome passes it through unchanged. + Entry("YAML sidecar", "Sidecar YAML", true, "sidecar yaml line", "eng"), ) })