Skip to content

Add CRLF frontmatter regression tests for loop-sync - #489

Open
shaurya703 wants to merge 1 commit into
cobusgreyling:mainfrom
shaurya703:test/479-loop-sync-crlf-frontmatter
Open

Add CRLF frontmatter regression tests for loop-sync#489
shaurya703 wants to merge 1 commit into
cobusgreyling:mainfrom
shaurya703:test/479-loop-sync-crlf-frontmatter

Conversation

@shaurya703

Copy link
Copy Markdown

Fixes #479

Adds regression tests for extractFrontmatter in tools/loop-sync, locking in the CRLF fix from #476:

  • LF frontmatter still parses (existing behaviour)
  • CRLF frontmatter (---\r\nkey: value\r\n---\r\nbody) parses keys and values without trailing \r
  • ---hello (no newline after the opening fence) is rejected: empty frontmatter, body returned unchanged

Notes:

  • extractFrontmatter was module-private, so it is now exported from src/sync.ts to let the tests exercise it directly.
  • The committed dist/sync.js was stale relative to the src/sync.ts fix from fix(loop-sync): handle CRLF frontmatter correctly #476 (it still had the pre-fix startsWith('---') logic), so dist is rebuilt in this PR. Without the rebuild, the ---hello rejection test fails against the committed dist.

Suite results (cd tools/loop-sync && npm test): 10 tests, 10 pass, 0 fail.

- Cover LF frontmatter (existing behaviour), CRLF frontmatter parsing
  keys/values without trailing \r, and rejection of an opening fence
  with no newline (---hello)
- Export extractFrontmatter so the regression tests can exercise it
  directly
- Rebuild dist, which was stale relative to the src fix from cobusgreyling#476

Fixes cobusgreyling#479
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.

Add CRLF frontmatter regression tests for loop-sync

1 participant