fix: progress broadcasts now use correct WebSocket room names

- Fixed room name mismatch: ProgressService was broadcasting to
  'download_progress' but JS clients join 'downloads' room
- Added _get_room_for_progress_type() mapping function
- Updated all progress methods to use correct room names
- Added 13 new tests for room name mapping and broadcast verification
- Updated existing tests to expect correct room names
- Fixed JS clients to join valid rooms (downloads, queue, scan)
This commit is contained in:
2025-12-16 19:21:30 +01:00
parent 4c9bf6b982
commit 700f491ef9
7 changed files with 490 additions and 17 deletions

View File

@@ -325,8 +325,9 @@ class TestWebSocketScanIntegration:
assert len(broadcasts) >= 2 # At least start and complete
# Check for scan progress broadcasts
# Room name is 'scan' for SCAN type progress
scan_broadcasts = [
b for b in broadcasts if b["room"] == "scan_progress"
b for b in broadcasts if b["room"] == "scan"
]
assert len(scan_broadcasts) >= 2
@@ -379,8 +380,9 @@ class TestWebSocketScanIntegration:
await anime_service.rescan()
# Verify failure broadcast
# Room name is 'scan' for SCAN type progress
scan_broadcasts = [
b for b in broadcasts if b["room"] == "scan_progress"
b for b in broadcasts if b["room"] == "scan"
]
assert len(scan_broadcasts) >= 2 # Start and fail
@@ -438,7 +440,7 @@ class TestWebSocketProgressIntegration:
start_broadcast = broadcasts[0]
assert start_broadcast["data"]["status"] == "started"
assert start_broadcast["room"] == "download_progress"
assert start_broadcast["room"] == "downloads" # Room name for DOWNLOAD type
update_broadcast = broadcasts[1]
assert update_broadcast["data"]["status"] == "in_progress"