Skip to main content
Glama
AssaysPage.test.tsx2.85 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { ObservationDefinition } from '@medplum/fhirtypes'; import { MockClient } from '@medplum/mock'; import { MedplumProvider } from '@medplum/react'; import { MemoryRouter } from 'react-router'; import { act, render, screen } from '../test-utils/render'; import { AssaysPage } from './AssaysPage'; const medplum = new MockClient(); async function setup(): Promise<void> { await act(async () => { render( <MemoryRouter> <MedplumProvider medplum={medplum}> <AssaysPage /> </MedplumProvider> </MemoryRouter> ); }); } describe('AssaysPage', () => { test('Renders', async () => { await medplum.createResource({ resourceType: 'ObservationDefinition', id: '1', code: { coding: [{ display: 'Assay 1' }] }, quantitativeDetails: { unit: { text: 'mg/dL' }, decimalPrecision: 2, }, } as ObservationDefinition); await setup(); expect(screen.getByText('Assay 1')).toBeInTheDocument(); }); test('Reference range', async () => { await medplum.createResource({ resourceType: 'ObservationDefinition', id: '1', code: { coding: [{ display: 'Assay 1' }] }, qualifiedInterval: [{ range: { low: { value: 0, unit: 'mg/dL' }, high: { value: 100, unit: 'mg/dL' } } }], } as ObservationDefinition); await setup(); expect(screen.getByText('Assay 1')).toBeInTheDocument(); expect(screen.getByText('0 - 100 mg/dL')).toBeInTheDocument(); }); test('Qualified range', async () => { await medplum.createResource({ resourceType: 'ObservationDefinition', id: '1', code: { coding: [{ display: 'Assay 1' }] }, qualifiedInterval: [ { gender: 'female', age: { high: { value: 30, unit: 'year' } }, range: { low: { value: 0, unit: 'mg/dL' }, high: { value: 100, unit: 'mg/dL' } }, }, { gender: 'female', age: { low: { value: 31, unit: 'year' } }, range: { low: { value: 0, unit: 'mg/dL' }, high: { value: 100, unit: 'mg/dL' } }, }, { gender: 'male', age: { high: { value: 30, unit: 'year' } }, range: { low: { value: 0, unit: 'mg/dL' }, high: { value: 100, unit: 'mg/dL' } }, }, { gender: 'male', age: { low: { value: 31, unit: 'year' } }, range: { low: { value: 0, unit: 'mg/dL' }, high: { value: 100, unit: 'mg/dL' } }, }, ], } as ObservationDefinition); await setup(); expect(screen.getByText('Assay 1')).toBeInTheDocument(); expect(screen.getByText('Female')).toBeInTheDocument(); expect(screen.getByText('Male')).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