add targeted test for mappingService missing mapping scenario#2808
add targeted test for mappingService missing mapping scenario#2808sydseter merged 1 commit intoOWASP:masterfrom
Conversation
- Covers try/catch branch for missing mapping files - Improves branch coverage - No production code changes
|
Hi @sydseter, The coverage improvements for MappingService are passing locally and in the website test suite. However, the COPI test suite is currently failing due to overall coverage being below the required threshold (92.6% vs 95%). This appears to be unrelated to the changes in this PR, as no COPI/backend code was modified. Please let me know if you would prefer handling COPI coverage improvements in a separate PR, or if I should investigate this further. Thanks! |
|
I noticed this coverage drop also occurred during a previous PR when test distribution changed. Happy to take a look at improving coverage in COPI or API routes in a separate, minimal PR if that would be helpful |
|
Thanks for the review and merge! |
Description
Adds a targeted test to improve branch coverage for MappingService.
The new test simulates a scenario where a mapping file is missing for a known deck, ensuring that the try/catch path in getCardMappingForAllVersions() is properly exercised and handled gracefully.
Changes
Scope Note
This PR focuses only on MappingService coverage.
Coverage improvements for the CRE API will be handled separately to keep changes minimal and well-scoped.
Motivation
This edge case was previously untested and could lead to silent failures if not handled correctly. Adding this test ensures robustness when mapping files are missing.
All changes were verified manually to ensure they align with the existing implementation and do not introduce unintended behavior.
Resolved or fixed issue: #2807
⸻
AI Tool Disclosure
• My contribution includes AI-generated content, as disclosed below:
• AI Tools: ChatGPT, VS Code Codex
• LLMs and versions: GPT-5.3 (ChatGPT), Codex (VS Code)
• Prompts: Guidance on identifying uncovered branches and writing minimal, targeted test cases
⸻
Affirmation
• My code follows the CONTRIBUTING.md guidelines