Skip to content

test(metadata): add explicit tests for slugger regexp replacements#676

Open
shivxmsharma wants to merge 1 commit intonodejs:mainfrom
shivxmsharma:test/slugger-regexps
Open

test(metadata): add explicit tests for slugger regexp replacements#676
shivxmsharma wants to merge 1 commit intonodejs:mainfrom
shivxmsharma:test/slugger-regexps

Conversation

@shivxmsharma
Copy link

Description

Adds explicit unit tests for the slug function and createNodeSlugger
factory in src/generators/metadata/utils/slugger.mjs, as requested in
issue #636.

Tests cover each of the six DOC_API_SLUGS_REPLACEMENTS individually
using an identity function as slugFn to isolate each regexp from
github-slugger's own transformations, plus integration tests using the
real github-slugger pipeline, and deduplication behaviour of the
stateful slugger factory.

Validation

node --run test — 333 tests, 0 failures.

Related Issues

Closes #636

Check List

  • I have read the Contributing Guidelines and made commit messages
    that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have checked code formatting with node --run format &
    node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@shivxmsharma shivxmsharma requested a review from a team as a code owner March 14, 2026 15:02
Copilot AI review requested due to automatic review settings March 14, 2026 15:02
@vercel
Copy link

vercel bot commented Mar 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Mar 14, 2026 3:03pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new unit test suite to explicitly verify the slug() replacement pipeline and the stateful createNodeSlugger() behavior in the metadata generator utilities, addressing the request in issue #636 for clearer regression coverage of the slugger regex logic.

Changes:

  • Adds explicit unit tests for each DOC_API_SLUGS_REPLACEMENTS rule using an identity slugFn to isolate regex behavior.
  • Adds integration tests exercising the default github-slugger pipeline.
  • Adds tests validating createNodeSlugger() deduplication and per-instance state isolation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.59%. Comparing base (38c58bc) to head (b9ba11f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
- Coverage   74.74%   74.59%   -0.15%     
==========================================
  Files         146      147       +1     
  Lines       13255    13494     +239     
  Branches      960      998      +38     
==========================================
+ Hits         9907    10066     +159     
- Misses       3342     3422      +80     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Testing our RegExps

4 participants