Skip to content

Added unit tests & docs#87

Merged
yatharthk2 merged 15 commits intousemoss:mainfrom
PredictiveManish:unit-tests-vitepress
Apr 7, 2026
Merged

Added unit tests & docs#87
yatharthk2 merged 15 commits intousemoss:mainfrom
PredictiveManish:unit-tests-vitepress

Conversation

@PredictiveManish
Copy link
Copy Markdown
Contributor

@PredictiveManish PredictiveManish commented Mar 28, 2026

Summary:

Add comprehensive unit tests for the vitepress-plugin-moss package, expanding test coverage from 5 to 45 tests covering the core plugin functionality. This ensures reliability and maintainability of the plugin.

Please ensure that your PR meets the following requirements:

  • I have read the CONTRIBUTING guide.
  • I have updated the documentation (if applicable).
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Description

Test File Expanded

tests/index.test.ts - Expanded from 5 to 45 tests

Test Suite Tests Description
resolveId - virtual module 3 Virtual module resolution
resolveId - component shadowing 7 VPNavBarSearch component replacement
load - config loading 18 Configuration loading and character escaping
buildEnd - index sync 8 Index synchronization and error handling
closeBundle 2 Bundle close lifecycle
plugin metadata 2 Plugin name and enforce order

Key Test Coverage

  1. Component Shadowing: Tests for replacing VitePress search components with Moss search
  2. Character Escaping: All 12 unsafe characters (<, >, /, \, \n, \r, \t, \0, \b, \f, \u2028, \u2029)
  3. Error Handling: Missing credentials validation with proper error messages
  4. Build Lifecycle: buildEnd and closeBundle hooks
  5. Configuration: Provider checks, null/undefined/empty configs

Fixes #45

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
Screenshot 2026-03-28 222011
Open with Devin

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 28, 2026

@PredictiveManish is attempting to deploy a commit to the Moss Team Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/vitepress-plugin-moss/package-lock.json Outdated

This comment was marked as resolved.

PredictiveManish and others added 4 commits March 29, 2026 07:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@HarshaNalluru
Copy link
Copy Markdown
Contributor

Thanks @PredictiveManish! Good expansion of test coverage on the resolveId, load, and character escaping paths.
Would love a review from @CoderOMaster before merging.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 29, 2026

CLA assistant check
All committers have signed the CLA.

@CoderOMaster
Copy link
Copy Markdown
Collaborator

@PredictiveManish @HarshaNalluru I think its good to go, just vitepress CI is failing can you please fix that @PredictiveManish ?

@PredictiveManish
Copy link
Copy Markdown
Contributor Author

@PredictiveManish @HarshaNalluru I think its good to go, just vitepress CI is failing can you please fix that @PredictiveManish ?

Sure will do it very soon.

@yatharthk2
Copy link
Copy Markdown
Collaborator

Is this ready for review ?

@PredictiveManish
Copy link
Copy Markdown
Contributor Author

Is this ready for review ?

Facing some test issues, when solved will tag for merging.

Copy link
Copy Markdown
Contributor Author

@PredictiveManish PredictiveManish left a comment

Choose a reason for hiding this comment

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

@HarshaNalluru I have a small query that Why after commiting, it doesn't automatically runs all the tests? Like I've observed that when someone from maintainers comments or review anything only after that comment or review it runs all the tests and shows failures/passed is this some kind of workflow or anything else?

@yatharthk2
Copy link
Copy Markdown
Collaborator

Hi @PredictiveManish , we have recently enabled test workflows for all. Please let me know if you have any questions.

@yatharthk2
Copy link
Copy Markdown
Collaborator

@PredictiveManish, Please let me know if you are still working this.

@PredictiveManish
Copy link
Copy Markdown
Contributor Author

@PredictiveManish, Please let me know if you are still working this.

Yeah, sorry for the delay actually was busy with a hackathon. It's over will work on this to fix the remaining bugs.

@PredictiveManish
Copy link
Copy Markdown
Contributor Author

@yatharthk2 I think it's now fixed, let me know if there's any other thing you see wrong here.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@yatharthk2 yatharthk2 merged commit 1844955 into usemoss:main Apr 7, 2026
13 of 14 checks passed
@PredictiveManish PredictiveManish deleted the unit-tests-vitepress branch April 7, 2026 16:09
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.

Implement Unit Testing for vitepress-plugin-moss

6 participants