-
Notifications
You must be signed in to change notification settings - Fork 4
test: Add Minimal MCP API Client Tests #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Add Minimal MCP API Client Tests #474
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| const zodiosError = new Error( | ||
| 'Zodios: Invalid response - status: 200 OK', | ||
| ) | ||
| ;(zodiosError as any).data = mockResponseData |
Copilot
AI
Jul 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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( |
Copilot
AI
Jul 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| expect((error as Error).message).to.equal( | |
| expect(error.message).to.equal( |
e22fab7 to
3bed5e4
Compare
* test: add minimal mcp api client tests * fix: address pr feedback for type safety improvements * test: improve test assertion formatting for readability
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