package main import ( "net/http" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // The Library Type dropdown on /admin/library (and the setup wizard, which // shares LibraryTypeOptions) must render from the DB-backed library_types // table. Regression: audiobooks shipped backend-complete (constant, allowed // extensions, MIME map, schema seed row, /api/libraries/types) while the // dropdowns hardcoded the original three types, so an audiobook library // could not be created from the UI. func TestAdminLibraryPageDropdownCoversAllLibraryTypes(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") } setup := setupTestServer(t) code, html := ssrGet(t, setup.Server.URL+"/admin/library", setup.Token) require.Equal(t, http.StatusOK, code) for _, typ := range []string{"ebooks", "comics", "manga", "audiobooks"} { assert.Contains(t, html, `value="`+typ+`"`, "library type %q missing from the create-library dropdown", typ) } assert.Contains(t, html, "Audiobooks") // Options come from the DB loop, not the deleted hardcode: exactly one // audiobooks option per page. assert.Equal(t, 1, strings.Count(html, `value="audiobooks"`)) }