test(metadata): add explicit tests for slugger regexp replacements#676
test(metadata): add explicit tests for slugger regexp replacements#676shivxmsharma wants to merge 1 commit intonodejs:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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_REPLACEMENTSrule using an identityslugFnto isolate regex behavior. - Adds integration tests exercising the default
github-sluggerpipeline. - 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Description
Adds explicit unit tests for the
slugfunction andcreateNodeSluggerfactory in
src/generators/metadata/utils/slugger.mjs, as requested inissue #636.
Tests cover each of the six
DOC_API_SLUGS_REPLACEMENTSindividuallyusing an identity function as
slugFnto isolate each regexp fromgithub-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
that follow the guideline.
node --run testand all tests passed.node --run format&node --run lint.