-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(refactor) O3-4059 Fix Inaccurate Test Result Time Stamps #2067
Open
CynthiaKamau
wants to merge
1
commit into
main
Choose a base branch
from
O3-4059
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected format that was replace here should be re-instated. This is the format dates should be displayed in in O3. Please do not invent new date formats.