Skip to content

Expand Markpub parser test coverage#31

Merged
pfefferle merged 1 commit intoadd/markpub-parserfrom
add/markpub-parser-tests
Apr 23, 2026
Merged

Expand Markpub parser test coverage#31
pfefferle merged 1 commit intoadd/markpub-parserfrom
add/markpub-parser-tests

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Apr 22, 2026

Fixes #30

Stacked on #9. Merge that first.

Proposed changes:

  • Add 21 new behavioral tests for Markpub parser block handlers that were untested or only loosely asserted in Add Markpub content parser #9.
  • Priority 1 — handler branches: listing() ordered/unordered/empty-skip/inline-formatting, quote() inner paragraph/multi-line/innerHTML fallback, container() for core/group/core/columns/core/column, fallback() delegation to container when innerBlocks exist.
  • Priority 2 — branches inside covered handlers: image-without-img-tag, heading default level, heading/paragraph whitespace handling, code language fence, code entity decoding, link parentheses percent-encoding, <br> hard break, inline entity decoding, inline image inside paragraph, nested bold/italic.
  • Priority 3 — assertion strengthening: tighten four contract assertions from assertStringContainsString to assertSame, and extend test_html_to_markdown_filter to verify the (markdown, content) 2-arg contract.

Whitespace-handling tests use mixed-content fixtures (whitespace block followed by a non-empty sibling) so a regression returning "" from a handler fails the exact-match assertion rather than being masked by parse()'s whole-post empty guard.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • npm run env-test -- --filter=Test_Markpub — all 40 tests pass (54 assertions).
  • composer lint — zero PHPCS errors.

Changelog entry

Tests-only change, no user-facing impact. Using "Skip Changelog" label.

  • Automatically create a changelog entry from the details below.

Fill the branch-coverage gaps flagged during the Markpub parser
review. Adds tests for list handler (ordered/unordered, empty-item
skip, inline formatting), quote handler (inner paragraph, multi-line,
innerHTML fallback), container handler (group, columns, column),
fallback delegation, image-without-img-tag, heading default level,
whitespace handling for heading/paragraph, code language fence,
code entity decoding, link paren encoding, <br> hard break, inline
entity decoding, inline image, and nested inline formatting.

Tightens four existing contract assertions from assertStringContainsString
to assertSame so format drift surfaces as a test failure. Extends the
atmosphere_html_to_markdown filter test to verify the 2-arg contract.

Fixes #30

Stacked on #9 — merge that first.
@kraftbj kraftbj added the Skip Changelog No changelog entry needed label Apr 22, 2026
@kraftbj kraftbj self-assigned this Apr 22, 2026
@github-actions github-actions Bot added [Feature] Content Parser Content parser for AT Protocol [Feature] Transformer AT Protocol record transformers [Tests] Includes Tests PR includes test changes labels Apr 22, 2026
@kraftbj kraftbj changed the base branch from trunk to add/markpub-parser April 22, 2026 14:56
@kraftbj kraftbj changed the title Expand Markpub parser test coverage (#30) Expand Markpub parser test coverage Apr 22, 2026
@kraftbj kraftbj requested a review from pfefferle April 22, 2026 18:41
@pfefferle pfefferle merged commit 5610f98 into add/markpub-parser Apr 23, 2026
13 of 14 checks passed
@pfefferle pfefferle deleted the add/markpub-parser-tests branch April 23, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Content Parser Content parser for AT Protocol [Feature] Transformer AT Protocol record transformers Skip Changelog No changelog entry needed [Tests] Includes Tests PR includes test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand Markpub parser test coverage for untested block handlers

2 participants