Skip to main content
Glama
setupTests.ts1.44 kB
// Jest setup file import "@testing-library/jest-dom"; // Mock window.matchMedia Object.defineProperty(window, "matchMedia", { writable: true, value: jest.fn().mockImplementation((query) => ({ matches: false, media: query, onchange: null, addListener: jest.fn(), // deprecated removeListener: jest.fn(), // deprecated addEventListener: jest.fn(), removeEventListener: jest.fn(), dispatchEvent: jest.fn(), })), }); // Mock ResizeObserver ( global as typeof globalThis & { ResizeObserver: typeof ResizeObserver } ).ResizeObserver = jest.fn().mockImplementation(() => ({ observe: jest.fn(), unobserve: jest.fn(), disconnect: jest.fn(), })); // Mock IntersectionObserver ( global as typeof globalThis & { IntersectionObserver: typeof IntersectionObserver; } ).IntersectionObserver = jest.fn().mockImplementation(() => ({ observe: jest.fn(), unobserve: jest.fn(), disconnect: jest.fn(), })); // Mock navigator.clipboard Object.defineProperty(navigator, "clipboard", { value: { readText: jest.fn(), writeText: jest.fn(), }, writable: true, }); // Mock console methods to reduce noise in tests const originalConsole = { ...console }; beforeAll(() => { console.log = jest.fn(); console.error = jest.fn(); console.warn = jest.fn(); console.info = jest.fn(); console.debug = jest.fn(); }); afterAll(() => { Object.assign(console, originalConsole); });

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/babelcloud/gru-sandbox'

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