Skip to content

fix: test graphics ElementExpressionHelper#4233

Merged
Julusian merged 1 commit into
mainfrom
fix/convert-graphics-helper-tests
Jun 8, 2026
Merged

fix: test graphics ElementExpressionHelper#4233
Julusian merged 1 commit into
mainfrom
fix/convert-graphics-helper-tests

Conversation

@Julusian

@Julusian Julusian commented Jun 8, 2026

Copy link
Copy Markdown
Member

Chunk from #4228

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved expression and value handling with better default behavior for missing properties
    • Enhanced string parsing with fallback support when variable parsing fails
    • Fixed number parsing to properly handle NaN cases
    • Improved expression evaluation for string values
  • New Features

    • Added case-insensitive enum matching based on string values
    • Added support for nested element property access with automatic value normalization

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55af1b1d-f3bd-4cfc-8a50-5b4e4e0c96bc

📥 Commits

Reviewing files that changed from the base of the PR and between 5262128 and fe3af38.

📒 Files selected for processing (2)
  • companion/lib/Graphics/ConvertGraphicsElements/Helper.ts
  • companion/test/Graphics/ConvertGraphicsElements/Helper.test.ts

📝 Walkthrough

Walkthrough

This PR enhances ElementExpressionHelper with improved robustness in expression and value parsing, adds two new public methods for tolerant enum matching and row-scoped helper creation, and provides comprehensive test coverage validating all existing and new behavior.

Changes

Graphics element expression helper robustness

Layer / File(s) Summary
Expression/value handling improvements
companion/lib/Graphics/ConvertGraphicsElements/Helper.ts
Core getter methods revise #getValue, getParsedString, getNumber, and getString to normalize missing values, NaN results, and parsing failures by always returning configured defaultValue instead of propagating empty strings or invalid states.
New public methods: tolerant enum and row helper
companion/lib/Graphics/ConvertGraphicsElements/Helper.ts
getTolerantEnum performs case-insensitive enum matching on the first non-whitespace character; forRow normalizes unknown row objects into scoped ElementExpressionHelper instances that share the parser and variable tracking with the parent.
Test scaffolding and comprehensive coverage
companion/test/Graphics/ConvertGraphicsElements/Helper.test.ts
Full vitest suite validates expression execution and variable ID tracking, all getter methods with edge cases (NaN, undefined, syntax errors, missing variables), row-scoped access behavior, element override precedence, and per-helper context isolation.

Poem

🎨 Helper methods bloom with grace,
Tolerant enums find their place,
NaN and undefined now tamed,
Row-scoped helpers—well-framed,
Tests ensure no edge case stays unnamed. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: test graphics ElementExpressionHelper' describes the main change—adding tests for the ElementExpressionHelper class—but uses 'fix:' which typically indicates a bug fix, while the changeset is primarily about adding test coverage for existing functionality. Consider using 'test:' or 'tests:' prefix instead of 'fix:' to accurately reflect that this is test implementation rather than a bug fix (e.g., 'test: add graphics ElementExpressionHelper tests').
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-project-automation github-project-automation Bot moved this to In Progress in Companion Plan Jun 8, 2026
@Julusian Julusian added this to the v5.0 milestone Jun 8, 2026
@Julusian Julusian merged commit 8ec389f into main Jun 8, 2026
18 checks passed
@Julusian Julusian deleted the fix/convert-graphics-helper-tests branch June 8, 2026 17:34
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Companion Plan Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant