Skip to content

Conversation

@v-volod
Copy link
Collaborator

@v-volod v-volod commented Dec 18, 2025

What

This PR improves the error handling and test coverage for the design token conversion process. The converter now throws specific, descriptive errors for unsupported or malformed tokens instead of failing silently.

Why

This change makes the token conversion process more robust and easier to debug. Explicit errors clarify issues within the design token files, which was previously difficult with silent failures. The increased test coverage ensures the converter's reliability and prevents future regressions.

Changes

  • Package.swift: Added new test resources to cover more file-related test cases.
  • SnappThemingDesignTokensSupport:
    • Enhanced DesignTokensConverter to throw an error for malformed dynamic color groups.
    • Improved various DesignTokens...ValueExtractors to throw specific errors for unsupported types, unresolved references, and other invalid values.
    • Made several error enums public to be accessible for external consumers.
    • Simplified data conversion in SnappThemingParser+DesignTokens by removing a redundant check.
  • SnappThemingDesignTokensSupportTests:
    • Significantly expanded SnappThemingDesignTokensParserTests with numerous new test cases for various failure scenarios (e.g., unsupported types, invalid values, malformed groups).
    • Added DesignTokensTokenValueExtractorTests to test type mismatch errors.
    • Introduced a PassthroughTokenProcessor utility to better isolate converter logic in tests.
    • Added new test resources (unknown, unsupported.extension) for file handling tests.
    • Enabled a previously disabled test.

@v-volod v-volod linked an issue Dec 18, 2025 that may be closed by this pull request
@v-volod v-volod changed the title 4 cover more test cases Improve test coverage Dec 18, 2025
@github-actions
Copy link

🛡️ Code Coverage Report

Target Lines Coverage
1 SnappThemingDesignTokensSupport 613 99.67%

Generated by Swift Coverage Action.

@v-volod v-volod merged commit 6e11e92 into main Dec 18, 2025
1 check passed
@v-volod v-volod deleted the 4-cover-more-test-cases branch December 18, 2025 12:52
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.

Cover more test cases

3 participants