Skip to main content
Glama
BackboneElementDisplay.test.tsx2.58 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { MockClient } from '@medplum/mock'; import { MedplumProvider } from '@medplum/react-hooks'; import { MemoryRouter } from 'react-router'; import { act, render, screen } from '../test-utils/render'; import type { BackboneElementDisplayProps } from './BackboneElementDisplay'; import { BackboneElementDisplay } from './BackboneElementDisplay'; const medplum = new MockClient(); describe('BackboneElementDisplay', () => { async function setup(args: BackboneElementDisplayProps): Promise<void> { await act(async () => render( <MemoryRouter> <MedplumProvider medplum={medplum}> <BackboneElementDisplay {...args} /> </MedplumProvider> </MemoryRouter> ) ); } test('Renders null', async () => { await setup({ path: 'Patient.contact', value: { type: 'PatientContact', value: null }, }); }); test('Renders value', async () => { await setup({ path: 'Patient.contact', value: { type: 'PatientContact', value: { id: '123', name: { given: ['John'], family: 'Doe', }, }, }, }); expect(screen.getByText('Name')).toBeInTheDocument(); }); test('Ignore missing properties', async () => { await setup({ path: 'Patient.contact', value: { type: 'PatientContact', value: { id: '123', }, }, ignoreMissingValues: true, }); expect(screen.queryByText('Name')).not.toBeInTheDocument(); }); test('Renders simple name', async () => { await setup({ path: 'Patient.contact', value: { type: 'PatientContact', value: { name: 'Simple Name', }, }, }); expect(screen.getByText('Simple Name')).toBeInTheDocument(); }); test('Handles name object value', async () => { await setup({ path: 'Organization.contact', value: { type: 'OrganizationContact', value: { name: { given: ['John'], family: 'Doe', }, }, }, }); expect(screen.getByText('John Doe')).toBeInTheDocument(); }); test('Not implemented', async () => { await setup({ path: 'Foo', value: { type: 'Foo', value: { foo: 'bar', }, }, }); expect(screen.getByText('Foo not implemented')).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