Skip to main content
Glama
ProjectAdminConfigPage.test.tsx1.68 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { MantineProvider } from '@mantine/core'; import { Notifications } from '@mantine/notifications'; import { MockClient } from '@medplum/mock'; import { MedplumProvider } from '@medplum/react'; import { act, fireEvent, render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router'; import { AppRoutes } from '../AppRoutes'; const medplum = new MockClient(); function setup(): void { render( <MedplumProvider medplum={medplum}> <MemoryRouter initialEntries={['/admin/config']} initialIndex={0}> <MantineProvider> <Notifications /> <AppRoutes /> </MantineProvider> </MemoryRouter> </MedplumProvider> ); } describe('ProjectAdminConfigPage', () => { beforeEach(() => { jest.spyOn(medplum, 'isProjectAdmin').mockImplementation(() => true); }); test('Force set password', async () => { setup(); await act(async () => { fireEvent.change(screen.getByLabelText('Email *'), { target: { value: 'alice@example.com' } }); }); await act(async () => { fireEvent.change(screen.getByLabelText('Password *'), { target: { value: 'override123' } }); }); await act(async () => { fireEvent.click(screen.getByRole('button', { name: 'Force Set Password' })); }); expect(screen.getByText('Done')).toBeInTheDocument(); }); test('Access denied', async () => { jest.spyOn(medplum, 'isProjectAdmin').mockImplementationOnce(() => false); setup(); expect(screen.getByText('Forbidden')).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