Skip to content

Commit

Permalink
(test) O3-2292: Add tests for encounter-observations (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-AI authored Aug 5, 2023
1 parent 7a2237d commit 52bd419
Showing 1 changed file with 36 additions and 0 deletions.
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();
});
});

0 comments on commit 52bd419

Please sign in to comment.