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
+4 -9
View File
@@ -119,19 +119,14 @@ func TestWebSocketProgressBroadcast(t *testing.T) {
ws.SetReadDeadline(time.Now().Add(5 * time.Second))
_, _, _ = ws.ReadMessage()
// Update progress via HTTP API
// Update progress via HTTP API to new media-item progress endpoint
progressReq := map[string]interface{}{
"source": "test",
"location": map[string]interface{}{
"percentage": 0.5,
},
"device_metadata": map[string]interface{}{
"device_type": "web",
},
"percentage": 0.5,
"epubcfi": "epubcfi(/6/4/2:10)",
}
body, _ := json.Marshal(progressReq)
req, _ := http.NewRequest("POST", setup.Server.URL+"/api/progress/"+mediaID, strings.NewReader(string(body)))
req, _ := http.NewRequest("PUT", setup.Server.URL+"/api/media-items/"+mediaID+"/progress", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)