lamplighter-mcp
Version:
An intelligent context engine for AI-assisted software development
58 lines (39 loc) • 1.93 kB
Markdown
# Lamplighter-MCP Tests
This directory contains tests for the Lamplighter-MCP application.
## Test Structure
The tests follow a unit testing approach using Jest with TypeScript support. The tests are organized as follows:
1. **Module Tests**
- `historyLogger.test.ts` - Tests for the HistoryLogger module
- `codebaseAnalyzer.test.ts` - Tests for the CodebaseAnalyzer module
2. **Component Tests**
- `server.test.ts` - Tests for the server components (Express, MCP Server, SSE Transport)
## Testing Approach
The testing approach focuses on:
1. **Unit Tests with Mocking**
- External dependencies are mocked to isolate the unit being tested
- File system operations (fs) are mocked to avoid actual file I/O
- Environment variables are managed per test
2. **Testing Core Functionality**
- HistoryLogger tests verify initialization and logging functionality
- CodebaseAnalyzer tests verify the summary generation process
- Server component tests verify basic functionality of key components
## Running Tests
To run the tests:
```bash
npm test -- --config=jest.config.ts
```
## Test Dependencies
The tests require the following dependencies:
- Jest - Test framework
- ts-jest - TypeScript support for Jest
- jest-environment-jsdom - DOM environment for Jest (for DOM tests)
## Mocking Strategy
- **File System Operations**: We mock the fs/promises module to avoid actual file I/O
- **External Modules**: External dependencies are mocked using jest.mock
- **Environment Variables**: We manage process.env for each test to ensure isolation
## Code Coverage
The current code coverage is:
- HistoryLogger: ~92% line coverage
- CodebaseAnalyzer: ~11% line coverage (primary functionality mocked)
- Server Components: Basic component testing only
Future improvements should focus on increasing coverage for the CodebaseAnalyzer and adding more extensive tests for the server functionality.