fix(tests): Add missing addFolderToLibrary call to TestMediaItemISBNNormalization

- TestMediaItemISBNNormalization was missing library folder creation
- Caused HTTP 400 errors when creating media items
- addFolderToLibrary call was accidentally removed from line 73
- Tests now properly create library with folder before adding media items

This fixes the root cause of ISBN normalization test failures where
media-item creation failed due to missing library folder requirement.
This commit is contained in:
2026-02-11 15:32:09 -05:00
parent f93d44c5d1
commit 5d93577078
2 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ ENV RATE_LIMIT_ENABLED=false
ENV REQUESTS_PER_MINUTE=1000
# Default command for running tests
CMD ["go", "test", "./cmd/server/tests", "-v", "-timeout", "5m"]
CMD ["go", "test", "./cmd/server/tests", "-v", "-timeout", "5m", "-parallel=1"]
# Final stage
FROM alpine:latest
+7 -4
View File
@@ -69,6 +69,9 @@ func TestMediaItemISBNNormalization(t *testing.T) {
token := loginTestUser(t, setup.Server, setup.DB)
libID := createTestLibrary(t, setup.Server, token, "test-isbn-lib")
// Add a folder to the library (required before adding media items)
addFolderToLibrary(t, setup.Server, token, libID, "/app/uploads")
// Test ISBN normalization cases
testCases := []struct {
name string
@@ -210,7 +213,7 @@ func TestMediaItemISBNEdgeCases(t *testing.T) {
token := loginTestUser(t, setup.Server, setup.DB)
libID := createTestLibrary(t, setup.Server, token, "test-isbn-edge-lib")
addFolderToLibrary(t, setup.Server, token, libID, "/test/folder")
addFolderToLibrary(t, setup.Server, token, libID, "/app/uploads")
t.Run("Empty ISBN should be accepted", func(t *testing.T) {
payload := map[string]interface{}{
@@ -295,7 +298,7 @@ func TestMediaItemsPagination(t *testing.T) {
token := loginTestUser(t, setup.Server, setup.DB)
libID := createTestLibrary(t, setup.Server, token, "test-pagination-lib")
addFolderToLibrary(t, setup.Server, token, libID, "/test/folder")
addFolderToLibrary(t, setup.Server, token, libID, "/app/uploads")
// Create some test media items
for i := 1; i <= 5; i++ {
@@ -427,7 +430,7 @@ func TestMediaItemLibraryRequirement(t *testing.T) {
t.Run("Create media-item with existing library should succeed", func(t *testing.T) {
libID := createTestLibrary(t, setup.Server, token, "test-req-lib")
addFolderToLibrary(t, setup.Server, token, libID, "/test/folder")
addFolderToLibrary(t, setup.Server, token, libID, "/app/uploads")
payload := map[string]interface{}{
"title": "Valid Book",
@@ -465,7 +468,7 @@ func TestUpdateMediaItemISBN(t *testing.T) {
token := loginTestUser(t, setup.Server, setup.DB)
libID := createTestLibrary(t, setup.Server, token, "test-update-lib")
addFolderToLibrary(t, setup.Server, token, libID, "/test/folder")
addFolderToLibrary(t, setup.Server, token, libID, "/app/uploads")
// First create a media item
createPayload := map[string]interface{}{