Skip to content

test: cover mdx-to-markdown block, fence and attribute edge cases - #274

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-mdx-to-markdown-edge-cases
Oct 8, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-mdx-to-markdown-edge-cases

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds scripts/mdx-to-markdown.edge-cases.test.ts (29 tests) covering the converter paths that had no tests:

  • Block parsing: unterminated block (note + content kept), stray closing tag, nested same-name <Step> depth tracking, closing tags inside fences ignored
  • Fences: ~~~ fences, a 4-backtick fence not closed by ~~~/```, fence lines with trailing text not treated as a close
  • dedent: all-blank body, zero-indent body
  • parseAttrs: single quotes, {false}, negative/decimal numbers, {"quoted"} unwrap, non-literal expression text
  • Renderers: YouTube url with existing ? → &t=, missing/non-numeric start; Step heading-only / number-only; AgentBlock unknown-id capitalisation and Agent fallback
  • Frontmatter: CRLF, single-quoted values, non-key: value lines, mismatched quotes
  • Options: description fallback, no title/description, trailing-slash siteBase, custom imagePrefix/rewriteImage with image title, blank-line collapsing, inline-code protection

scripts/mdx-to-markdown.ts: 93.1% stmts / 79.7% branches → 100% / 99.2% (npx vitest run scripts/mdx-to-markdown --coverage). Full suite, eslint, prettier --check and tsc --noEmit pass.

No production code changed. The linked-image regex quirk noted in the issue is intentionally not asserted so it is not locked in.

Closes #273


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Adds scripts/mdx-to-markdown.edge-cases.test.ts exercising the converter
paths that had no tests: unterminated and nested blocks, stray closing
tags, fence-aware close detection (tilde fences, longer fences, fence
lines with trailing text), dedent of blank/zero-indent bodies, attribute
parsing fallbacks, YouTube/Step/AgentBlock rendering variants, CRLF and
single-quoted frontmatter, and the siteBase/imagePrefix/rewriteImage
options.

mdx-to-markdown.ts: 93.1% stmts / 79.7% branches -> 100% / 99.2%.

Closes #273

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hivecommons-docs ready!

Name Link
🔨 Latest commit 1db971a
🔍 Latest deploy log https://app.netlify.com/projects/hivecommons-docs/deploys/6ac73d0d70cd6900081d5b38
😎 Deploy Preview https://deploy-preview-274--hivecommons-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hivecommons-hive
hivecommons-hive Bot merged commit fc3fc8d into main Oct 8, 2026
10 of 11 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-mdx-to-markdown-edge-cases branch October 8, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] scripts/mdx-to-markdown.ts: 21 untested branches in block/fence parsing and attr fallbacks

0 participants