/**
* Contract Tests for MCP Resources
* Tests MCP protocol compliance for all resource implementations
*/
import { describe, test, expect } from 'vitest';
// Import server implementation
import { createDesignPatternsServer } from '../../src/mcp-server.js';
describe('MCP Resources Contract Tests', () => {
test('should create MCP server successfully', async () => {
// This test verifies that the MCP server implementation exists and can be created
const config = {
databasePath: './data/design-patterns.db',
logLevel: 'info' as const,
enableLLM: false,
maxConcurrentRequests: 10,
};
const server = createDesignPatternsServer(config);
expect(server).toBeDefined();
expect(typeof server.start).toBe('function');
expect(typeof server.stop).toBe('function');
});
test('should have MCP resources handler', async () => {
// This test verifies that the resources handler is properly implemented
const config = {
databasePath: './data/design-patterns.db',
logLevel: 'info' as const,
enableLLM: false,
maxConcurrentRequests: 10,
};
const server = createDesignPatternsServer(config);
// Check if the server has the required handlers registered
// The server should have handlers for ReadResourceRequestSchema and ListResourcesRequestSchema
expect(server).toBeDefined();
expect(typeof server.start).toBe('function');
expect(typeof server.stop).toBe('function');
});
});