Skip to main content
Glama

Linear MCP Integration Server

by skspade
utils.test.ts1.52 kB
import { describe, it, expect } from '@jest/globals'; // Import the utility functions to test // Note: In a real test, you would import these from the actual module // For demonstration purposes, we'll redefine them here // Utility to create a timeout promise function createTimeout(ms: number, message: string) { return new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${ms}ms: ${message}`)), ms) ); } // Utility to wrap promises with timeout async function withTimeout<T>(promise: Promise<T>, timeoutMs: number, context: string): Promise<T> { try { const result = await Promise.race([ promise, createTimeout(timeoutMs, context) ]) as T; return result; } catch (error: any) { if (error?.message?.includes('Timeout after')) { console.error(`Operation timed out: ${context}`); } throw error; } } describe('Utility Functions', () => { describe('withTimeout', () => { it('should resolve when the promise resolves before timeout', async () => { const fastPromise = Promise.resolve('success'); const result = await withTimeout(fastPromise, 1000, 'Fast operation'); expect(result).toBe('success'); }); it('should reject when the promise takes longer than the timeout', async () => { const slowPromise = new Promise((resolve) => setTimeout(() => resolve('too late'), 100)); await expect(withTimeout(slowPromise, 50, 'Slow operation')).rejects.toThrow('Timeout after 50ms'); }); }); });

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/skspade/mcp-linear-server'

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