package e2e
import (
"net/http"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Routing", func() {
BeforeEach(func() { setupTestDB() })
It("routes authenticated endpoints case-insensitively", func() {
lower := queryResult(get("/items?IncludeItemTypes=MusicAlbum&Recursive=true"))
Expect(lower.TotalRecordCount).To(Equal(5))
})
It("returns a JSON 404 for an unknown route", func() {
w := get("/Nonexistent/Route")
Expect(w.Code).To(Equal(http.StatusNotFound))
Expect(w.Header().Get("Content-Type")).To(HavePrefix("application/json"))
Expect(w.Body.String()).To(ContainSubstring("{}"))
})
It("returns 404 for an unsupported method on a known path", func() {
w := jReq(adminUser, "PUT", "/Items", "")
Expect(w.Code).To(Equal(http.StatusNotFound))
})
})