test: add E2E template variable rendering tests #59

Merged
xiaomo merged 1 commits from fix/52-template-variable-rendering into main 2026-05-31 09:15:33 +00:00
Owner

What

Added comprehensive E2E test coverage for template variable rendering in LiquidJS templates, specifically addressing issue #52 where payload variables were reported as not being filled in rendered output.

Why

Issue #52 reported that when rendering nodes with registered LiquidJS templates, payload variables (name, age, etc.) appeared empty in output. Investigation revealed this was a user error - LiquidJS templates require payload.name syntax rather than name to access node payload properties.

Changes

  • Added Suite 9: E2E Template Variable Rendering (12 tests)
    • Test 9.1: Reproduces the bug scenario (direct property access)
    • Test 9.2: Validates correct payload.* syntax (fixes #52)
    • Test 9.3: CLI E2E integration test
    • Tests 9.4-9.12: Edge cases (primitives, nested objects, arrays, null, booleans, zero, empty strings, special chars)
  • Added Suite 10: Context Variable Completeness (2 tests)
    • Test 10.1: Context propagation in recursive renders
    • Test 10.2: Context isolation between parent/child nodes
  • Total: 606 lines of comprehensive test code

Verification

  • All 395 tests pass across entire codebase
  • All 14 new tests pass
  • Build passes
  • Lint passes
  • TypeScript strict mode compliant
  • No regressions introduced

Ref

Fixes #52

## What Added comprehensive E2E test coverage for template variable rendering in LiquidJS templates, specifically addressing issue #52 where payload variables were reported as not being filled in rendered output. ## Why Issue #52 reported that when rendering nodes with registered LiquidJS templates, payload variables (name, age, etc.) appeared empty in output. Investigation revealed this was a user error - LiquidJS templates require payload.name syntax rather than name to access node payload properties. ## Changes - Added Suite 9: E2E Template Variable Rendering (12 tests) - Test 9.1: Reproduces the bug scenario (direct property access) - Test 9.2: Validates correct payload.* syntax (fixes #52) - Test 9.3: CLI E2E integration test - Tests 9.4-9.12: Edge cases (primitives, nested objects, arrays, null, booleans, zero, empty strings, special chars) - Added Suite 10: Context Variable Completeness (2 tests) - Test 10.1: Context propagation in recursive renders - Test 10.2: Context isolation between parent/child nodes - Total: 606 lines of comprehensive test code ### Verification - All 395 tests pass across entire codebase - All 14 new tests pass - Build passes - Lint passes - TypeScript strict mode compliant - No regressions introduced ## Ref Fixes #52
xiaoju added 1 commit 2026-05-31 08:34:06 +00:00
Add comprehensive test suite (Suite 9 and 10) covering template variable rendering:
- Suite 9: E2E Template Variable Rendering (12 tests)
  - Tests correct {{ payload.* }} syntax vs incorrect direct property access
  - Tests primitive payloads (string, number)
  - Tests nested objects, arrays, null values, booleans
  - Tests edge cases: empty strings, zero values, special characters
  - Validates CLI integration flow
- Suite 10: Context Variable Completeness (2 tests)
  - Verifies context propagation through recursive renders
  - Tests context isolation between parent and child nodes

All tests pass. Confirms the renderNode function correctly passes
node.payload to template context. Issue #52 was user error - templates
require {{ payload.name }} syntax, not {{ name }}.

Fixes #52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaomo approved these changes 2026-05-31 09:15:19 +00:00
xiaomo left a comment
Owner

LGTM 纯测试 PR,覆盖全面。

LGTM ✅ 纯测试 PR,覆盖全面。
xiaomo merged commit 885a8e1147 into main 2026-05-31 09:15:33 +00:00
xiaomo deleted branch fix/52-template-variable-rendering 2026-05-31 09:15:33 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#59