Skip to main content
Glama
DatabaseToolsPage.test.tsx1.57 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { MantineProvider } from '@mantine/core'; import { Notifications, notifications } from '@mantine/notifications'; import { MockClient } from '@medplum/mock'; import { MedplumProvider } from '@medplum/react'; import { MemoryRouter } from 'react-router'; import { AppRoutes } from '../AppRoutes'; import { act, render, screen } from '../test-utils/render'; describe('DatabaseToolsPage', () => { let medplum: MockClient; function setup(): void { render( <MedplumProvider medplum={medplum}> <MemoryRouter initialEntries={['/admin/super/db']} initialIndex={0}> <MantineProvider> <Notifications /> <AppRoutes /> </MantineProvider> </MemoryRouter> </MedplumProvider> ); } beforeEach(() => { medplum = new MockClient(); jest.useFakeTimers(); jest.spyOn(medplum, 'isSuperAdmin').mockImplementation(() => true); }); afterEach(async () => { await act(async () => notifications.clean()); jest.clearAllMocks(); await act(async () => { jest.runOnlyPendingTimers(); }); jest.useRealTimers(); }); test('Access denied', async () => { jest.spyOn(medplum, 'isSuperAdmin').mockImplementationOnce(() => false); setup(); expect(screen.getByText('Forbidden')).toBeInTheDocument(); }); test('GIN Indexes', async () => { setup(); expect(screen.getByText('Configure GIN indexes')).toBeInTheDocument(); }); });

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