Skip to main content
Glama
api-client.test.ts1.33 kB
import { describe, it, expect, beforeEach, afterEach } from '@jest/globals'; import { ApiClient, resetApiClient } from '../../src/api/client.js'; import { ErrorCode } from '../../src/types/index.js'; describe('ApiClient', () => { let client: ApiClient; beforeEach(() => { resetApiClient(); client = new ApiClient(); }); describe('Retry Logic', () => { it('should retry on 5xx errors', async () => { // TODO: implement mock/fetch interception to simulate 5xx responses }); it('should not retry on 4xx errors', async () => { // TODO: implement mock/fetch interception to simulate 4xx responses }); it('should respect maxRetries config', async () => { // TODO: implement }); }); describe('Timeout', () => { it('should timeout after configured duration', async () => { // TODO: implement using a slow response simulation }); it('should throw API_TIMEOUT error', async () => { // TODO: assert mapping to ErrorCode.API_TIMEOUT }); }); describe('Error Mapping', () => { it('should map 429 to API_RATE_LIMIT', async () => { // TODO: simulate 429 response and assert mapped error code }); it('should map timeout to API_TIMEOUT', async () => { // TODO: simulate timeout and assert mapped error code }); }); });

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/pace8/Test'

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