Skip to content

test(render-method-2024): assert digestMultibase covers raw bytes, not cleaned template#28

Merged
ashleythedeveloper merged 1 commit into
mainfrom
test/digest-raw-bytes-contract
May 15, 2026
Merged

test(render-method-2024): assert digestMultibase covers raw bytes, not cleaned template#28
ashleythedeveloper merged 1 commit into
mainfrom
test/digest-raw-bytes-contract

Conversation

@ashleythedeveloper
Copy link
Copy Markdown
Contributor

Adds a regression test that locks the documented contract on constructRenderMethodAsync: the digestMultibase it generates covers the raw template bytes the caller passed in, not the whitespace-normalised template that ends up stored in the output.

The existing test suite covered the two halves separately ("digest verifies against the input template" with a single-line template that has nothing to normalise; "stored template is cleaned" without checking the digest). The new test exercises a multi-line input and asserts the divergence in one place, including the negative case: parsed.verify(result.template) MUST be false. A future change that switched the hash to operate on the cleaned bytes (to make the digest "consistent" with the stored field) would fail this test.

Test-only change; no functional code touched. No version bump.

Test plan

  • New test passes locally (yarn test src/__tests__/construct-render-method-async.test.ts → 10 tests pass)
  • Full suite still green
  • Lint, format, build clean

@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage Report

Lines Statements Branches Functions
Coverage: 100%
100% (172/172) 97.91% (47/48) 90.9% (30/33)
Tests Skipped Failures Errors Time
99 0 💤 0 ❌ 0 🔥 2.386s ⏱️

@ashleythedeveloper ashleythedeveloper merged commit fbbd486 into main May 15, 2026
4 checks passed
@ashleythedeveloper ashleythedeveloper deleted the test/digest-raw-bytes-contract branch May 15, 2026 11:04
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.

1 participant