Skip to content

Conversation

@jonathannorris
Copy link
Member

Implements essential test coverage for the DevCycle MCP server's API client infrastructure.

What's Added

  • 6 focused tests for DevCycleApiClient class in src/mcp/utils/api.test.ts
  • Covers critical user-facing functionality without over-testing edge cases

Key Coverage Areas

  • Zodios error handling - Ensures API schema mismatch recovery
  • Authentication workflows - Validates auth requirements and error handling
  • Dashboard link generation - Tests core user workflow feature
  • Header management - Verifies MCP tool tracking for telemetry

@jonathannorris jonathannorris requested a review from a team as a code owner July 25, 2025 17:57
@jonathannorris jonathannorris changed the base branch from main to feat-mcp-server July 25, 2025 17:57

This comment was marked as outdated.

@jonathannorris jonathannorris requested a review from Copilot July 25, 2025 17:58
Copy link

Copilot AI left a 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

Comment on lines 35 to 38
const zodiosError = new Error(
'Zodios: Invalid response - status: 200 OK',
)
;(zodiosError as any).data = mockResponseData
Copy link

Copilot AI Jul 25, 2025

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.

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,
)

Copilot uses AI. Check for mistakes.
)
assert.fail('Expected function to throw')
} catch (error) {
expect((error as Error).message).to.equal(
Copy link

Copilot AI Jul 25, 2025

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.

Suggested change
expect((error as Error).message).to.equal(
expect(error.message).to.equal(

Copilot uses AI. Check for mistakes.
@jonathannorris jonathannorris force-pushed the test-add-minimal-mcp-api-tests branch from e22fab7 to 3bed5e4 Compare July 25, 2025 18:18
@jonathannorris jonathannorris merged commit 0011a5a into feat-mcp-server Jul 25, 2025
8 checks passed
@jonathannorris jonathannorris deleted the test-add-minimal-mcp-api-tests branch July 25, 2025 18:21
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants