Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

feat(navigation): navigate to patients profile on related person click #1792

Merged
merged 19 commits into from
Feb 7, 2020

Conversation

ocBruno
Copy link
Contributor

@ocBruno ocBruno commented Feb 5, 2020

Fixes #1763

Changes proposed in this pull request:

  • clicking on related person navigates to patient profile
  • add history to related person tests and refactor the tests to fix conflicts

@vercel
Copy link

vercel bot commented Feb 5, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/hospitalrun/hospitalrun-frontend/cyrqb4cw2
✅ Preview: https://hospitalrun-front-git-fork-ocbruno-feat-related-person-n-095f6f.hospitalrun.now.sh

Copy link
Member

@jackcmeyer jackcmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments. Also, I think there is a test missing for the functionality of clicking on a related person and have it navigate to that patient profile. Am I missing it?


const onSave = newRelatedPersonModal.prop('onSave') as any
onSave(expectedRelatedPerson)
await act(async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this test getting updated?

Copy link
Contributor Author

@ocBruno ocBruno Feb 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting errors and there was an async operation that used the wrappers which I was creating with the setup function so I made setup async and adapted the rest of the file. The test is indeed missing the new functionality, I refactored all the tests for the changes but forgot to add the new one.

But i'm pretty sure this needs to be refactored looking over it. I used the await async example from another test to get the tests working after my update but I think there is a better resolution. I'll take a look at these async actions later and rethink the solution, if anyone has any ideas drop in!

Comment on lines 25 to 36
let history = createMemoryHistory()
const setup = async (location: string, patient: Patient, user: any) => {
history = createMemoryHistory()
history.push(location)
return mount(
<Router history={history}>
<Provider store={mockStore({ patient, user })}>
<RelatedPersonTab patient={patient} />
</Provider>
</Router>,
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need a setup method in this test.

I think that doing the setup in a beforeEach is sufficient. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it would be more performant and reusable we make the beforeeach but I think we with the setup wrapper we can call it once on the describe scope instead of each test and in cases where we need a new patient user or route we call the setup function in the individual test. Give me a heads up and I'll finish refactoring this as necessary

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a setup may not be necessary because each describe has a different use case.

I’ve found the setup function to be helpful when the same describe needs different setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the test changes and added the related test!

@vercel vercel bot temporarily deployed to Preview February 5, 2020 17:46 Inactive
@jackcmeyer jackcmeyer added 🚀enhancement an issue/pull request that adds a feature to the application patients issue/pull request that interacts with patients module labels Feb 6, 2020
@jackcmeyer jackcmeyer added this to In progress in Version 2.0 via automation Feb 6, 2020
@jackcmeyer jackcmeyer added this to the v2.0.0 milestone Feb 6, 2020
Copy link
Member

@jackcmeyer jackcmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When hovering over the related person, it should have a cursor ico.

I think we can add the action prop to ListItem and it will add it

jackcmeyer
jackcmeyer previously approved these changes Feb 6, 2020
Copy link
Member

@jackcmeyer jackcmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@vercel vercel bot temporarily deployed to Preview February 7, 2020 10:01 Inactive
@vercel vercel bot temporarily deployed to Preview February 7, 2020 15:15 Inactive
@matteovivona matteovivona merged commit 78447f8 into HospitalRun:master Feb 7, 2020
Version 2.0 automation moved this from In progress to Done Feb 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚀enhancement an issue/pull request that adds a feature to the application patients issue/pull request that interacts with patients module
Projects
Version 2.0
  
Done
Development

Successfully merging this pull request may close these issues.

Clicking on related person should navigate to patient profile
4 participants