Skip to content

add targeted test for mappingService missing mapping scenario#2808

Merged
sydseter merged 1 commit intoOWASP:masterfrom
theanand108:fix/mappingservice-coverage
Apr 14, 2026
Merged

add targeted test for mappingService missing mapping scenario#2808
sydseter merged 1 commit intoOWASP:masterfrom
theanand108:fix/mappingservice-coverage

Conversation

@theanand108
Copy link
Copy Markdown
Contributor

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

•	Covers try/catch branch for missing mapping files
•	Improves branch coverage
•	No production code 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

- Covers try/catch branch for missing mapping files
- Improves branch coverage
- No production code changes
@theanand108
Copy link
Copy Markdown
Contributor Author

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!

@theanand108
Copy link
Copy Markdown
Contributor Author

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

@sydseter sydseter merged commit f900950 into OWASP:master Apr 14, 2026
7 of 9 checks passed
@theanand108 theanand108 deleted the fix/mappingservice-coverage branch April 14, 2026 09:42
@theanand108
Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge!
I’ll continue contributing with similar focused improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants