Skip to main content
Glama
TEST_GUIDE.md3.97 kB
# Comprehensive Testing Guide for Atrax Type Improvements This guide outlines the test strategy for validating the type improvements made in Steps 1-8 of our plan to replace `any` with proper TypeScript types. ## Test Coverage Overview We've created a comprehensive set of tests in these categories: 1. **Type Definition Tests** - Validate our custom type definitions 2. **McpProxy Tests** - Test the improved method determination with generics 3. **ServerRegistry Tests** - Validate improved pendingResponses Map and sendMessage with generics 4. **Transport Tests** - Test the typed event handlers in transport implementations 5. **Auth Config Tests** - Verify the discriminated union approach for auth types 6. **Integration Tests** - End-to-end message flow with proper types ## Running the Tests To run all tests: ```bash npm test ``` To run specific test categories: ```bash # Run only unit tests npm test -- --testPathPattern=tests/unit # Run only a specific test file npm test -- --testPathPattern=tests/unit/mcp-types.test.ts ``` ## Test Files ### Unit Tests 1. **Type Definition Tests** - `tests/unit/mcp-types.test.ts` - Tests for JSONRPCErrorObject, MethodParams, MethodResults, and McpCapabilities - Validates type mapping for MCP methods - Tests compile-time type assertions 2. **McpProxy Tests** - `tests/unit/mcp-proxy.test.ts` - Tests for type-safe method determination - Tests for direct message handling - Tests client transport management with typed events 3. **ServerRegistry Tests** - `tests/unit/server-registry.test.ts` - Tests improved pendingResponses Map with proper types - Tests sendMessage with generic type support - Validates end-to-end message flow with typed responses 4. **Transport Tests** - `tests/unit/transport.test.ts` - Tests typed event handlers for all transport implementations - Validates message handling with proper types - Tests error handling with typed errors 5. **Auth Config Tests** - `tests/unit/auth-config.test.ts` - Tests discriminated union approach for auth types - Validates type guards for runtime type checking - Tests compile-time type safety for auth configurations ### Integration Tests 1. **MCP Types Integration Tests** - `tests/integration/mcp-types-integration.test.ts` - End-to-end testing of message flow through the entire system - Validates proper typing at each stage of message handling - Tests error handling with proper types ## What to Look For When running the tests, look for the following: 1. **Compile-Time Type Errors**: The TypeScript compiler should catch any type mismatches 2. **Runtime Type Validation**: Type guards should properly validate at runtime 3. **Type Inference**: Generic types should properly infer return types 4. **Error Handling**: Errors should be properly typed and handled 5. **Edge Cases**: The tests cover various edge cases, including: - Missing fields in messages - Invalid configuration options - Server disconnection during pending requests - Timeout handling - Error propagation ## Additional Validations After running the tests, these manual checks should be performed: 1. **Build Validation**: Ensure the project builds without errors ```bash npm run build ``` 2. **Smoke Tests**: Run the smoke tests to ensure end-to-end functionality ```bash cd tests/smoke ./test-atrax.sh ``` 3. **Inspector Tool Testing**: Use the MCP Inspector tool to verify protocol compliance (This will be covered in Step 10 of our plan) ## Reporting Issues If you find any issues during testing, please document them with: 1. The specific test that failed 2. The expected vs. actual behavior 3. Any relevant error messages 4. The file and line number where the issue occurs ## Next Steps After completing Step 9 (Comprehensive Testing), we will move to Step 10 (MCP Inspector Tool Testing) to verify protocol compliance using the official MCP Inspector tool.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/metcalfc/atrax'

If you have feedback or need assistance with the MCP directory API, please join our Discord server