async def test_subscribe_sync_job_not_found(self, mock_db, mock_user):
        """Test subscribing to a sync job that doesn't exist.

        Note: The current implementation doesn't validate job existence,
        it will create a subscription that waits for messages that may never come.
        """
        # Arrange
        job_id = uuid.uuid4()

        # Create a mock Redis PubSub instance for non-existent job
        mock_pubsub = AsyncMock()

        # Create an async generator that only yields subscription confirmation
        async def mock_listen():
            # Only yield a subscribe message, no data will come
            yield {"type": "subscribe", "data": None}
            # In real scenario, this would wait forever for messages

        mock_pubsub.listen = mock_listen
        mock_pubsub.close = AsyncMock()

        with patch(
            "airweave.platform.sync.pubsub.sync_pubsub.subscribe", new_callable=AsyncMock
        ) as mock_subscribe:
            # Subscribe will always return a pubsub instance
            mock_subscribe.return_value = mock_pubsub

            # Act - Use new signature with user dependency injection
            response = await sync.subscribe_sync_job(job_id=job_id, user=mock_user)

            # Assert - it creates a streaming response even for non-existent jobs
            mock_subscribe.assert_called_once_with(job_id)
            assert isinstance(response, StreamingResponse)
            assert response.media_type == "text/event-stream"
Test subscribing to a sync job that doesn't exist.

        Note: The current implementation doesn't validate job existence,
        it will create a subscription that waits for messages that may never come.
        
backend/tests/unit/api/test_sync.py