Skip to main content
Glama
server.test.ts4.25 kB
describe('Server Functionality', () => { describe('Environment Variables', () => { it('should have test environment configured', () => { expect(process.env.NODE_ENV).toBe('test'); expect(process.env.FIGMA_API_KEY).toBeDefined(); }); it('should have cache configuration', () => { expect(process.env.CACHE_TTL).toBeDefined(); expect(process.env.CACHE_MAX_SIZE).toBeDefined(); }); it('should have rate limiting configuration', () => { expect(process.env.RATE_LIMIT_REQUESTS_PER_MINUTE).toBeDefined(); expect(process.env.RATE_LIMIT_BURST_SIZE).toBeDefined(); }); }); describe('Tool Definitions', () => { const expectedTools = [ 'show_frameworks', 'get_figma_data', 'process_design_comments', 'download_design_assets', 'check_reference' ]; it('should have all 5 required tools', () => { // This test verifies the tool names are correct expectedTools.forEach(toolName => { expect(toolName).toMatch(/^[a-z_]+$/); expect(toolName.length).toBeGreaterThan(0); }); }); it('should have proper tool naming convention', () => { expectedTools.forEach(toolName => { expect(toolName).toMatch(/^[a-z][a-z_]*[a-z]$/); expect(toolName).not.toContain('__'); expect(toolName.startsWith('_')).toBe(false); expect(toolName.endsWith('_')).toBe(false); }); }); }); describe('Framework Support', () => { const supportedFrameworks = [ 'react', 'vue', 'angular', 'svelte', 'html', 'swiftui', 'uikit', 'electron', 'tauri', 'nwjs' ]; it('should support 10 frameworks', () => { expect(supportedFrameworks).toHaveLength(10); }); it('should have web frameworks', () => { const webFrameworks = ['react', 'vue', 'angular', 'svelte', 'html']; webFrameworks.forEach(framework => { expect(supportedFrameworks).toContain(framework); }); }); it('should have mobile frameworks', () => { const mobileFrameworks = ['swiftui', 'uikit']; mobileFrameworks.forEach(framework => { expect(supportedFrameworks).toContain(framework); }); }); it('should have desktop frameworks', () => { const desktopFrameworks = ['electron', 'tauri', 'nwjs']; desktopFrameworks.forEach(framework => { expect(supportedFrameworks).toContain(framework); }); }); }); describe('Error Handling', () => { const createMockError = (message: string, code?: string) => { const error = new Error(message); if (code) { (error as any).code = code; } return error; }; it('should handle network errors gracefully', () => { const networkError = createMockError('Network error', 'ECONNREFUSED'); expect(networkError.message).toBe('Network error'); expect((networkError as any).code).toBe('ECONNREFUSED'); }); it('should handle API errors gracefully', () => { const apiError = createMockError('API rate limit exceeded', 'RATE_LIMIT'); expect(apiError.message).toBe('API rate limit exceeded'); expect((apiError as any).code).toBe('RATE_LIMIT'); }); it('should handle validation errors gracefully', () => { const validationError = createMockError('Invalid URL format'); expect(validationError.message).toBe('Invalid URL format'); }); }); describe('Configuration Validation', () => { it('should validate required configuration', () => { const requiredEnvVars = [ 'FIGMA_API_KEY', 'CACHE_TTL', 'CACHE_MAX_SIZE', 'RATE_LIMIT_REQUESTS_PER_MINUTE', 'RATE_LIMIT_BURST_SIZE' ]; requiredEnvVars.forEach(envVar => { expect(process.env[envVar]).toBeDefined(); expect(process.env[envVar]).not.toBe(''); }); }); it('should have numeric configuration values', () => { expect(Number(process.env.CACHE_TTL)).toBeGreaterThan(0); expect(Number(process.env.CACHE_MAX_SIZE)).toBeGreaterThan(0); expect(Number(process.env.RATE_LIMIT_REQUESTS_PER_MINUTE)).toBeGreaterThan(0); expect(Number(process.env.RATE_LIMIT_BURST_SIZE)).toBeGreaterThan(0); }); }); });

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/artemsvit/Figma-MCP-Pro'

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