package e2eimport ("net/http""strings". "github.com/onsi/ginkgo/v2". "github.com/onsi/gomega")var _ = Describe("System", func() {BeforeEach(func() { setupTestDB() })Describe("GET /System/Info/Public", func() {It("returns public server info without authentication", func() {w := rawReq("GET", "/System/Info/Public", "")Expect(w.Code).To(Equal(http.StatusOK))var info map[string]anyparseInto(w, &info)Expect(info["ServerName"]).To(HavePrefix("Navidrome"))Expect(info["ProductName"]).To(Equal("Jellyfin Server"))Expect(info["StartupWizardCompleted"]).To(BeTrue())Expect(info["Id"]).ToNot(BeEmpty())Expect(info["Version"]).ToNot(BeEmpty())})It("routes case-insensitively (lowercase path)", func() {w := rawReq("GET", "/system/info/public", "")Expect(w.Code).To(Equal(http.StatusOK))})})Describe("GET /System/Info", func() {It("returns system info to any authenticated user, matching the public Version", func() {w := getAs(regularUser, "/System/Info")var info map[string]anyparseInto(w, &info)Expect(info["Version"]).ToNot(BeEmpty())Expect(info["SupportsLibraryMonitor"]).To(BeTrue())pub := rawReq("GET", "/System/Info/Public", "")var pubInfo map[string]anyparseInto(pub, &pubInfo)Expect(info["Version"]).To(Equal(pubInfo["Version"]))Expect(info["Id"]).To(Equal(pubInfo["Id"]))})It("rejects unauthenticated requests", func() {w := rawReq("GET", "/System/Info", "")Expect(w.Code).To(Equal(http.StatusUnauthorized))})})Describe("GET /System/Endpoint", func() {It("always reports IsInNetwork, which Finamp's connection test probes for", func() {w := getAs(regularUser, "/System/Endpoint")Expect(w.Code).To(Equal(http.StatusOK))var info map[string]anyparseInto(w, &info)Expect(info).To(HaveKey("IsInNetwork"))Expect(info).To(HaveKey("IsLocal"))})It("rejects unauthenticated requests", func() {w := rawReq("GET", "/System/Endpoint", "")Expect(w.Code).To(Equal(http.StatusUnauthorized))})})Describe("GET/POST /System/Ping", func() {It("answers GET with a plain-text server name", func() {w := rawReq("GET", "/System/Ping", "")Expect(w.Code).To(Equal(http.StatusOK))Expect(w.Header().Get("Content-Type")).To(HavePrefix("text/plain"))Expect(w.Body.String()).To(HavePrefix("Navidrome"))})It("answers POST identically", func() {w := rawReq("POST", "/System/Ping", "")Expect(w.Code).To(Equal(http.StatusOK))Expect(strings.TrimSpace(w.Body.String())).To(HavePrefix("Navidrome"))})})})