generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixing gitignore * upload functionality * Create upload file test * Adding state management * tests written for export and upload * Added ecr tests * adding type * Kenneth/export (#21) * fixing gitignore * upload functionality * Create upload file test * Adding state management * tests written for export and upload * Adding state management * tests written for export and upload * Added ecr tests * adding type * fixing package lock
- Loading branch information
1 parent
c06baf1
commit bad467b
Showing
7 changed files
with
95 additions
and
151 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { | ||
Table | ||
} from '@trussworks/react-uswds' | ||
import _ from 'lodash'; | ||
|
||
export default function ECRTable({ ecrData }) { | ||
const options = ['patient_id', 'first_name', 'last_name', 'gender', 'birth_date'] | ||
|
||
console.log(ecrData); | ||
|
||
const getTableBody = (data: any) => { | ||
return ( | ||
<tbody> | ||
{options.map(function (option) { | ||
return ( | ||
<tr key={option}> | ||
<th scope="row">{_.startCase(option)}</th> | ||
<td>{data[option]}</td> | ||
</tr> | ||
); | ||
})} | ||
|
||
</tbody> | ||
) | ||
} | ||
|
||
return ( | ||
<div className='margin-3'> | ||
<h1>eCR Viewer</h1> | ||
<div> | ||
<Table | ||
bordered | ||
caption="This table uses the fullWidth prop to increase to 100% width" | ||
fullWidth> | ||
<thead> | ||
<tr> | ||
<th scope="col">Field Name</th> | ||
<th scope="col">Field Value</th> | ||
</tr> | ||
</thead> | ||
{getTableBody(ecrData.processed_values.parsed_values)} | ||
</Table> | ||
</div> | ||
</div> | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import "@testing-library/jest-dom"; | ||
import ECRTable from '../../components/ECRTable'; // Adjust the import path as per your project structure | ||
|
||
describe('ECRTable', () => { | ||
it('renders ECRTable component with provided data', () => { | ||
const ecrData = { | ||
"processed_values": { | ||
"message": "Parsing succeeded!", | ||
"parsed_values": { | ||
"patient_id": "123", | ||
"person_id": null, | ||
"last_name": "BEAKER", | ||
"first_name": "CATEST", | ||
"birth_date": "2016-01-27", | ||
"gender": "female" | ||
} | ||
} | ||
}; | ||
|
||
render(<ECRTable ecrData={ecrData} />); | ||
|
||
// You can add more specific assertions here | ||
// For example, checking if the table headers and data are rendered | ||
expect(screen.getByText('eCR Viewer')).toBeInTheDocument(); | ||
expect(screen.getByText('Field Name')).toBeInTheDocument(); | ||
expect(screen.getByText('Field Value')).toBeInTheDocument(); | ||
expect(screen.getByText('Patient Id')).toBeInTheDocument(); | ||
expect(screen.getByText('123')).toBeInTheDocument(); | ||
// Add similar assertions for other data fields | ||
}); | ||
}); |
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