-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(refactor) O3-4059 Fix Inaccurate Test Result Time Stamps
- Loading branch information
1 parent
eab6490
commit 9f9b4cf
Showing
7 changed files
with
167 additions
and
91 deletions.
There are no files selected for viewing
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
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
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
67 changes: 32 additions & 35 deletions
67
...ent-tests-app/src/test-results/individual-results-table/individual-results-table.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 |
---|---|---|
@@ -1,53 +1,50 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { type OBSERVATION_INTERPRETATION } from '@openmrs/esm-patient-common-lib'; | ||
import IndividualResultsTable from './individual-results-table.component'; | ||
import { type GroupedObservation } from '../../types'; | ||
|
||
describe('IndividualResultsTable', () => { | ||
const mockSubRows = [ | ||
{ | ||
obs: [ | ||
{ | ||
obsDatetime: '2021-01-13 02:10:06.0', | ||
value: '52.1', | ||
interpretation: 'NORMAL' as const as OBSERVATION_INTERPRETATION, | ||
}, | ||
], | ||
datatype: 'Numeric', | ||
lowAbsolute: 0, | ||
display: 'Prothrombin time', | ||
conceptUuid: '161481AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', | ||
units: 'Minute', | ||
flatName: 'Hematology-Prothrombin Time (with INR)-Prothrombin time', | ||
hasData: true, | ||
entries: [ | ||
null, | ||
null, | ||
null, | ||
{ | ||
obsDatetime: '2021-01-13 02:10:06.0', | ||
value: '52.1', | ||
interpretation: 'NORMAL' as const as OBSERVATION_INTERPRETATION, | ||
}, | ||
], | ||
}, | ||
]; | ||
const mockSubRows = { | ||
key: 'HIV viral load', | ||
date: '2024-10-15', | ||
flatName: 'HIV viral load-HIV viral load', | ||
entries: [ | ||
{ | ||
obsDatetime: '2024-10-15 03:20:19.0', | ||
value: '45', | ||
interpretation: 'NORMAL', | ||
key: 'HIV viral load-HIV viral load', | ||
datatype: 'Numeric', | ||
lowAbsolute: 0, | ||
display: 'HIV viral load', | ||
conceptUuid: '856AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', | ||
units: 'copies/ml', | ||
flatName: 'HIV viral load-HIV viral load', | ||
hasData: true, | ||
}, | ||
], | ||
} as GroupedObservation; | ||
|
||
const mockEmptySubRows = { | ||
key: 'HIV viral load', | ||
date: '2024-10-15', | ||
flatName: 'HIV viral load-HIV viral load', | ||
entries: [], | ||
} as GroupedObservation; | ||
|
||
it('renders a loading skeleton when fetching results data', () => { | ||
render(<IndividualResultsTable isLoading={true} parent={{ display: 'Parent Test' }} subRows={[]} index={0} />); | ||
render(<IndividualResultsTable isLoading={true} subRows={mockEmptySubRows} index={0} title={'HIV viral load'} />); | ||
|
||
expect(screen.getByRole('progressbar')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders a tabular overview of the available test result data', () => { | ||
render( | ||
<IndividualResultsTable isLoading={false} parent={{ display: 'Parent Test' }} subRows={mockSubRows} index={0} />, | ||
); | ||
render(<IndividualResultsTable isLoading={false} subRows={mockSubRows} index={0} title={'HIV viral load'} />); | ||
|
||
expect(screen.getByText(/13-jan-2021/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/2024-10-15/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/test name/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/reference range/i)).toBeInTheDocument(); | ||
expect(screen.getByRole('button', { name: /view timeline/i })).toBeInTheDocument(); | ||
expect(screen.getByRole('row', { name: /prothrombin time 52.1 minute -- minute/i })).toBeInTheDocument(); | ||
expect(screen.getByRole('row', { name: /hiv viral load 45 copies\/ml -- copies\/ml/i })).toBeInTheDocument(); | ||
}); | ||
}); |
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
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
Oops, something went wrong.