UNPKG

apple-hig-mcp

Version:

High-performance MCP server providing instant access to Apple's Human Interface Guidelines via hybrid static/dynamic content delivery

89 lines 3.53 kB
/** * Server integration tests * * Note: Full server testing requires complex MCP SDK mocking. * These tests focus on the core server functionality that can be tested. */ import { HIGCache } from '../cache.js'; import { CrawleeHIGService } from '../services/crawlee-hig.service.js'; import { HIGResourceProvider } from '../resources.js'; import { HIGToolProvider } from '../tools.js'; describe('Server Component Integration', () => { let cache; let crawleeService; let resourceProvider; let toolProvider; beforeEach(() => { cache = new HIGCache(60); crawleeService = new CrawleeHIGService(cache); resourceProvider = new HIGResourceProvider(crawleeService, cache); toolProvider = new HIGToolProvider(crawleeService, cache, resourceProvider); }); afterEach(async () => { await crawleeService.teardown(); cache.clear(); }); test('should initialize all server components', () => { expect(cache).toBeInstanceOf(HIGCache); expect(crawleeService).toBeInstanceOf(CrawleeHIGService); expect(resourceProvider).toBeInstanceOf(HIGResourceProvider); expect(toolProvider).toBeInstanceOf(HIGToolProvider); }); test('should have proper component dependencies', () => { // Test that components are properly connected expect(crawleeService).toBeDefined(); expect(resourceProvider).toBeDefined(); expect(toolProvider).toBeDefined(); // Verify cache is shared const testKey = 'test-integration'; const testData = { test: 'data' }; cache.set(testKey, testData); expect(cache.get(testKey)).toEqual(testData); }); test('should handle server startup configuration', () => { // Test configuration values that would be used by the server const serverConfig = { name: 'apple-hig-mcp', version: '1.0.0', description: 'Model Context Protocol server for Apple Human Interface Guidelines', }; const capabilities = { resources: {}, tools: {}, }; expect(serverConfig.name).toBe('apple-hig-mcp'); expect(serverConfig.version).toBe('1.0.0'); expect(serverConfig.description).toContain('Apple Human Interface Guidelines'); expect(capabilities).toHaveProperty('resources'); expect(capabilities).toHaveProperty('tools'); }); test('should provide expected tool names', () => { // Test that the tools the server exposes match expectations const expectedTools = [ 'search_guidelines', 'get_component_spec', 'compare_platforms', 'get_latest_updates' ]; // These would be the tools registered in the actual server expectedTools.forEach(toolName => { expect(typeof toolName).toBe('string'); expect(toolName.length).toBeGreaterThan(0); }); }); test('should provide expected resource patterns', () => { // Test that the resource URI patterns match expectations const expectedResourcePatterns = [ /^hig:\/\/ios$/, /^hig:\/\/macos$/, /^hig:\/\/watchos$/, /^hig:\/\/tvos$/, /^hig:\/\/visionos$/, /^hig:\/\/updates\/latest$/ ]; expectedResourcePatterns.forEach(pattern => { expect(pattern).toBeInstanceOf(RegExp); }); }); }); //# sourceMappingURL=server.test.js.map