test: expand coverage for core utilities, providers, and error handling#39
Open
devhimanshuu wants to merge 2 commits into
Open
test: expand coverage for core utilities, providers, and error handling#39devhimanshuu wants to merge 2 commits into
devhimanshuu wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands Vitest coverage for Passmark’s core utilities around email handling, provider integration, and the custom error hierarchy to improve confidence and regression protection.
Changes:
- Adds unit tests for
PassmarkErrorand all custom error subclasses (verifying names/codes/properties). - Adds isolated tests for the Emailsink provider, including URL construction, JSON parsing behavior, and error cases.
- Adds tests for
extractEmailContentcovering initial configuration failure, success, retry behavior, and max-retry failure using fake timers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/tests/providers/emailsink.test.ts | New tests for Emailsink provider fetch/URL behavior, parsing, and failure cases. |
| src/tests/errors.test.ts | New tests validating custom error classes and their machine-readable codes. |
| src/tests/email.test.ts | Extends email tests to cover extractEmailContent retry/timeout flow using fake timers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What does this PR do?
This PR significantly improves the stability of Passmark by expanding test coverage for core components that were previously under-tested.
It successfully brings line coverage to 100% for:
src/errors.tssrc/email.tssrc/providers/emailsink.ts✨ Key Changes
src/errors.ts): Added comprehensive unit tests for all custom error classes to ensure they instantiate correctly with the appropriate machine-readable error codes.src/providers/emailsink.ts): Implemented isolated tests mocking thefetchAPI. This verifies successful content extraction, handles JSON parsing correctly, and properly catches edge-case errors.src/email.ts): Added tests forextractEmailContentusing Vitest's fake timers. This allowed us to verify retry logic, timeouts, and exponential backoff behavior without slowing down the overall test suite.