fix(tests): repair TestUnifiedSearch and TestWebSocketProgressBroadcast

TestUnifiedSearch: Search for 'zzzznonexistent' instead of 'test' which
matches leftover test data from other tests. Fixes false 200 instead of 404.

TestWebSocketProgressBroadcast: Update to new progress endpoint
/api/media-items/:id/progress with correct PUT body format matching
ProgressService (percentage, epubcfi). Use book_id instead of
media_item_id to match WebSocket broadcast payload field names.
This commit is contained in:
2026-04-25 21:34:58 -04:00
parent 2736409a79
commit 37f84dd3ea
2 changed files with 9 additions and 14 deletions
+5 -5
View File
@@ -93,14 +93,14 @@ func TestUnifiedSearch(t *testing.T) {
assert.Equal(t, http.StatusOK, rec.Code, "Should filter by has_cover")
})
t.Run("Missing library_id", func(t *testing.T) {
req := httptest.NewRequest("GET", "/api/media-items/search?q=test", nil)
t.Run("Missing library_id searches all libraries", func(t *testing.T) {
req := httptest.NewRequest("GET", "/api/media-items/search?q=zzzznonexistent", nil)
req.Header.Set("Authorization", "Bearer "+setup.UserToken)
rec := httptest.NewRecorder()
setup.Server.Config.Handler.ServeHTTP(rec, req)
// library_id is now optional - searches all libraries when omitted
// Returns 404 when no results match the search query
assert.Equal(t, http.StatusNotFound, rec.Code, "Should return 404 when no results found")
// library_id is optional - searches all libraries when omitted
// Returns 404 when no results match
assert.Equal(t, http.StatusNotFound, rec.Code, "Should return 404 when no results match")
})
}