Skip to main content
Glama
test.setup.ts1.75 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 // See: https://mantine.dev/guides/vitest/ import '@testing-library/jest-dom'; import { MemoryStorage, indexSearchParameterBundle, indexStructureDefinitionBundle } from '@medplum/core'; import { SEARCH_PARAMETER_BUNDLE_FILES, readJson } from '@medplum/definitions'; import type { Bundle, SearchParameter } from '@medplum/fhirtypes'; import { vi } from 'vitest'; const { getComputedStyle } = window; window.getComputedStyle = (elt) => getComputedStyle(elt); window.HTMLElement.prototype.scrollIntoView = () => {}; Object.defineProperty(window, 'matchMedia', { writable: true, value: vi.fn().mockImplementation((query) => ({ matches: false, media: query, onchange: null, addListener: vi.fn(), removeListener: vi.fn(), addEventListener: vi.fn(), removeEventListener: vi.fn(), dispatchEvent: vi.fn(), })), }); class ResizeObserver { observe(): void {} unobserve(): void {} disconnect(): void {} } window.ResizeObserver = ResizeObserver; // jsdom does not implement scrollIntoView // See: https://github.com/jsdom/jsdom/issues/1695#issuecomment-449931788 Element.prototype.scrollIntoView = vi.fn(); indexStructureDefinitionBundle(readJson('fhir/r4/profiles-types.json') as Bundle); indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle); indexStructureDefinitionBundle(readJson('fhir/r4/profiles-medplum.json') as Bundle); for (const filename of SEARCH_PARAMETER_BUNDLE_FILES) { indexSearchParameterBundle(readJson(filename) as Bundle<SearchParameter>); } Object.defineProperty(globalThis.window, 'sessionStorage', { value: new MemoryStorage() });

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/medplum/medplum'

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