Skip to main content
Glama
service-errors.test.ts1.25 kB
import { describe, it, expect, vi } from 'vitest'; import { LiaraClient } from '../../api/client.js'; import * as appService from '../../services/apps.js'; describe('Service Error Handling', () => { describe('App Service Errors', () => { it('should handle API errors when getting app', async () => { const mockClient = { get: vi.fn().mockRejectedValue(new Error('App not found')), } as any; await expect(appService.getApp(mockClient, 'nonexistent')).rejects.toThrow(); }); it('should validate app name before API call', async () => { const mockClient = { get: vi.fn(), } as any; await expect(appService.getApp(mockClient, '')).rejects.toThrow('App name is required'); await expect(appService.getApp(mockClient, 'ab')).rejects.toThrow(); }); }); describe('Database Service Errors', () => { it('should validate database name', async () => { const mockClient = { get: vi.fn(), } as any; await expect( appService.getApp(mockClient, undefined as any) ).rejects.toThrow(); }); }); });

Latest Blog Posts

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/razavioo/liara-mcp'

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