test: Add Minimal MCP API Client Tests#474
Merged
jonathannorris merged 3 commits intofeat-mcp-serverfrom Jul 25, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds essential test coverage for the DevCycle MCP server's API client infrastructure, implementing 6 focused tests for the DevCycleApiClient class to ensure critical user-facing functionality works correctly.
- Implements comprehensive test coverage for API client error handling and authentication
- Adds validation for dashboard link generation and header management features
- Provides focused testing without over-testing edge cases
src/mcp/utils/api.test.ts
Outdated
Comment on lines
35
to
38
| const zodiosError = new Error( | ||
| 'Zodios: Invalid response - status: 200 OK', | ||
| ) | ||
| ;(zodiosError as any).data = mockResponseData |
There was a problem hiding this comment.
Using any type casting weakens type safety. Consider creating a proper mock error type or using a more specific interface that extends Error with a data property.
Suggested change
| const zodiosError = new Error( | |
| 'Zodios: Invalid response - status: 200 OK', | |
| ) | |
| ;(zodiosError as any).data = mockResponseData | |
| class ZodiosValidationError extends Error { | |
| constructor(message: string, public data: any) { | |
| super(message) | |
| this.name = 'ZodiosValidationError' | |
| } | |
| } | |
| const zodiosError = new ZodiosValidationError( | |
| 'Zodios: Invalid response - status: 200 OK', | |
| mockResponseData, | |
| ) |
| ) | ||
| assert.fail('Expected function to throw') | ||
| } catch (error) { | ||
| expect((error as Error).message).to.equal( |
There was a problem hiding this comment.
Type casting to Error is unnecessary since the caught error in a try-catch block should already be of type Error based on the test setup.
Suggested change
| expect((error as Error).message).to.equal( | |
| expect(error.message).to.equal( |
JamieSinn
approved these changes
Jul 25, 2025
e22fab7 to
3bed5e4
Compare
jonathannorris
added a commit
that referenced
this pull request
Aug 11, 2025
* test: add minimal mcp api client tests * fix: address pr feedback for type safety improvements * test: improve test assertion formatting for readability
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.
Implements essential test coverage for the DevCycle MCP server's API client infrastructure.
What's Added
DevCycleApiClientclass insrc/mcp/utils/api.test.tsKey Coverage Areas