-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(test) O3-2292: Add tests for encounter-observations (#772)
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...sm-active-visits-app/src/visits-summary/visits-components/encounter-observations.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import EncounterObservations from './encounter-observations.component'; | ||
|
||
describe('EncounterObservations', () => { | ||
test('renders skeleton text while loading', () => { | ||
render(<EncounterObservations observations={null} />); | ||
|
||
expect(screen.queryByText('Temperature')).not.toBeInTheDocument(); | ||
}); | ||
|
||
test('renders "No observations found" message when observations list is empty', () => { | ||
const emptyObservations = []; | ||
render(<EncounterObservations observations={emptyObservations} />); | ||
|
||
expect(screen.getByText('No observations found')).toBeInTheDocument(); | ||
}); | ||
|
||
test('renders observations list correctly', () => { | ||
const observations = [ | ||
{ display: 'Temperature: 98.6°F' }, | ||
{ display: 'Blood Pressure: 120/80 mmHg' }, | ||
{ display: 'Heart Rate: 72 bpm' }, | ||
]; | ||
render(<EncounterObservations observations={observations} />); | ||
|
||
expect(screen.getByText('Temperature:')).toBeInTheDocument(); | ||
expect(screen.getByText('98.6°F')).toBeInTheDocument(); | ||
|
||
expect(screen.getByText('Blood Pressure:')).toBeInTheDocument(); | ||
expect(screen.getByText('120/80 mmHg')).toBeInTheDocument(); | ||
|
||
expect(screen.getByText('Heart Rate:')).toBeInTheDocument(); | ||
expect(screen.getByText('72 bpm')).toBeInTheDocument(); | ||
}); | ||
}); |