Skip to main content
Glama

myAI Memory Sync

by Jktfe
jest.setup.js1.89 kB
// This file sets up the Jest environment for all tests // Set up global types for TypeScript global.MockFn = jest.fn; // This will help with typing jest.mock calls global.defineMock = (modulePath, factory) => { jest.mock(modulePath, factory); }; // Create a helper to create properly typed mocks global.createTypedMock = (implementation) => { return jest.fn(implementation); }; // Mock fs/promises for all tests jest.mock('fs/promises'); // Tell TypeScript that cors is any type to prevent errors jest.mock('cors', () => { return jest.fn().mockReturnValue(jest.fn()); }); // Mock HTTP module with properly typed mocks jest.mock('http', () => { const mockServer = { listen: jest.fn((port, cb) => { if (typeof cb === 'function') cb(); return mockServer; }), on: jest.fn(), close: jest.fn((cb) => { if (typeof cb === 'function') cb(); }) }; return { createServer: jest.fn(() => mockServer), Server: jest.fn(), mockServer }; }); // Mock express with properly typed mocks jest.mock('express', () => { const mockApp = { use: jest.fn().mockReturnThis(), post: jest.fn().mockReturnThis(), get: jest.fn().mockReturnThis(), listen: jest.fn().mockImplementation((port, callback) => { if (typeof callback === 'function') callback(); return { on: jest.fn(), close: jest.fn().mockImplementation((callback) => { if (typeof callback === 'function') callback(); }) }; }) }; return jest.fn().mockReturnValue(mockApp); }); // Create a declaration to tell TypeScript about HttpTransport test methods global.declareHttpTransportTestMethods = (transport) => { transport.onMessage = jest.fn(); transport.sendMessage = jest.fn(); return transport; }; // This helps silence TypeScript errors in mock implementations process.on = process.on || jest.fn();

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/Jktfe/myAImemory-mcp'

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