test: add unit tests for ASR service and transcription API with subtitle coverage
🚀 Enhancement: Add Test Coverage for ASR Features
📌 Overview
This MR adds comprehensive test cases for the core functionalities of the ASR system, improving reliability and ensuring better validation of existing features.
✨ Features Covered by Tests
-
🎤 Speech-to-text transcription -
⏱ Timestamp/segment generation -
📝 Subtitle (SRT) generation -
🔄 API response structure validation
🧪 Test Cases Added
🔹 ASR Service (asr_service.py)
-
Tested subtitle (SRT) generation logic
-
Validated timestamp formatting (start, end, text)
-
Covered edge cases:
- Empty segments
- Multiple segments
🔹 API (main.py)
-
Tested
/api/transcribeendpoint -
Verified response structure:
textsegmentssrt
-
Handled edge cases:
- Empty input
- Invalid audio
✅ Coverage
- Added tests to improve backend coverage
- Covered core logic and edge cases for stability
🧪 How to Run Tests
pytest --cov=app --cov-report=term-missing
🎯 Outcome
- Improved confidence in ASR functionality
- Ensured correctness of subtitle generation
- Strengthened API reliability through testing