/**
* Server Core Test Suite
*
* Tests for MCP server setup and configuration
*/
import { createMCPServer, type ServerConfig } from './server.js';
import { RequestManager } from './request-manager.js';
import { ALL_TOOLS } from '../tools/index.js';
import { ALL_PROMPTS } from '../prompts/index.js';
describe('MCP Server Core', () => {
let server: ReturnType<typeof createMCPServer>;
let requestManager: RequestManager;
let config: ServerConfig;
beforeEach(() => {
config = {
name: 'test-server',
version: '1.0.0',
description: 'Test server for MCP functionality'
};
requestManager = new RequestManager();
server = createMCPServer(config, requestManager);
});
describe('Server Configuration', () => {
it('should create server with correct configuration', () => {
expect(server).toBeDefined();
// Server is created successfully if no errors are thrown
});
it('should have both tools and prompts capabilities', () => {
// This test verifies the server was created with both capabilities
// The actual capability checking would require access to server internals
expect(server).toBeDefined();
});
});
describe('Tools Integration', () => {
it('should have all expected tools available', () => {
expect(ALL_TOOLS).toHaveLength(4);
expect(ALL_TOOLS.map(t => t.name)).toContain('ask-one-question');
expect(ALL_TOOLS.map(t => t.name)).toContain('ask-multiple-choice');
expect(ALL_TOOLS.map(t => t.name)).toContain('challenge-hypothesis');
expect(ALL_TOOLS.map(t => t.name)).toContain('choose-next');
});
});
describe('Prompts Integration', () => {
it('should have all expected prompts available', () => {
expect(ALL_PROMPTS).toHaveLength(5);
expect(ALL_PROMPTS.map(p => p.name)).toContain('human-decision');
expect(ALL_PROMPTS.map(p => p.name)).toContain('expert-consultation');
expect(ALL_PROMPTS.map(p => p.name)).toContain('creative-brainstorm');
expect(ALL_PROMPTS.map(p => p.name)).toContain('suggest-follow-up-questions');
expect(ALL_PROMPTS.map(p => p.name)).toContain('refine-document');
});
it('should have valid prompt structures', () => {
ALL_PROMPTS.forEach(prompt => {
expect(prompt.name).toBeDefined();
expect(typeof prompt.name).toBe('string');
expect(prompt.description).toBeDefined();
expect(typeof prompt.description).toBe('string');
expect(prompt.arguments).toBeDefined();
expect(Array.isArray(prompt.arguments)).toBe(true);
// Validate argument structure
prompt.arguments.forEach(arg => {
expect(arg.name).toBeDefined();
expect(typeof arg.name).toBe('string');
expect(arg.description).toBeDefined();
expect(typeof arg.description).toBe('string');
expect(typeof arg.required).toBe('boolean');
});
});
});
});
describe('Request Manager Integration', () => {
it('should initialize request manager', () => {
expect(requestManager).toBeDefined();
expect(requestManager.getStorage()).toBeDefined();
});
});
});