AOSSIE-Org / AOSSIE-Org/EduAid

[BUG]: [Improvement] Add regression test for /get_mcq_answer response contract consistency

Đang mở
#606 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
JavaScript
Star
171
Fork
425
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Bug Description

### Description
After the fix in PR #590, `/get_mcq_answer` now correctly returns the `output` key for invalid/mismatched input cases.
However, there is no automated regression test to enforce this response contract, so future refactors could silently reintroduce the old `outputs` key or break the invalid-input behavior.

### Proposed Solution
Add a backend regression test that validates the invalid-input contract for `/get_mcq_answer`:
- response contains `output`
- response does not contain `outputs`
- response value is an empty list for mismatched question/options lengths

### Expected Behavior
The API contract remains stable over time, and CI catches regressions immediately if response keys or invalid-input behavior change.

### Steps to Reproduce

1. Start the backend server locally.
2. Send a POST request to `/get_mcq_answer` with mismatched input sizes:
- `input_question` with 2 entries
- `input_options` with 1 entry
3. Observe current behavior returns empty `output`.
4. Note that without regression coverage, this contract can be accidentally broken in future changes without automated detection.

### Logs and Screenshots

N/A (contract/regression coverage gap; no runtime crash required)

### Environment Details

- OS: Windows 11
- Backend: Python/Flask (EduAid backend)
- Endpoint: /get_mcq_answer
- Context: Follow-up to PR #590 contract standardization

### Impact

Medium - Feature works but has issues

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.