-
Notifications
You must be signed in to change notification settings - Fork 46
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
10261 Story: Practitioner Case List #5397
Conversation
…hat we can check counts precisely rather than either 1) fuzzy matching or 2) extending test time by creating cases
const openPagesPaginator = () => { | ||
return ( | ||
practitionerInformationHelper.showOpenCasesPagination && ( | ||
<Paginator | ||
currentPageIndex={practitionerInformationHelper.openCasesPageNumber} | ||
totalPages={practitionerInformationHelper.totalOpenCasesPages} | ||
onPageChange={selectedPage => { | ||
setPractitionerOpenCasesPageSequence({ | ||
pageNumber: selectedPage, | ||
}); | ||
}} | ||
/> | ||
) | ||
); | ||
}; | ||
|
||
const closedPagesPaginator = () => { | ||
return ( | ||
practitionerInformationHelper.showClosedCasesPagination && ( | ||
<Paginator | ||
currentPageIndex={ | ||
practitionerInformationHelper.closedCasesPageNumber | ||
} | ||
totalPages={practitionerInformationHelper.totalClosedCasesPages} | ||
onPageChange={selectedPage => { | ||
setPractitionerClosedCasesPageSequence({ | ||
pageNumber: selectedPage, | ||
}); | ||
}} | ||
/> | ||
) | ||
); | ||
}; |
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.
Ideally, I would want pagination to live on PractitionerCaseList
directly and be handled by using useState
and URL params; however, this goes against our current use of Cerebral.
I chose what I thought was the next best option: Rather than pass in specific global state into PractitionerCaseList
, which makes the component "messier," I chose to pass in the list of cases into PractitionerCaseList
and handle pagination here in this component since it is already connected to global state. This keeps us in line with using Cerebral but also keeps PractitionerCaseList
pretty simple and reusable.
…or component key, and remove TODO notes
applicationContext | ||
.getUseCases() | ||
.getPractitionerCasesInteractor.mockImplementation(() => { | ||
throw new Error('Unauthorized'); | ||
}); |
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 unauthorized error is now thrown on getPractitionerCasesInteractor
. That said, I think it is still important to test that generatePractitionerCaseListPdfInteractor
independently "bubbles up" that error.
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.
Tiniest of nits: could this also throw new UnauthorizedError('Unauthorized to view practitioners cases');
? Wouldn't even be worthy of another commit, just if you happen to change something else
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.
I like it. I'll keep this comment in mind.
@@ -82,75 +91,19 @@ describe('generatePractitionerCaseListPdfInteractor', () => { | |||
).rejects.toThrow('Practitioner not found'); | |||
}); | |||
|
|||
it('sorts open and closed cases before sending them to document generator', async () => { |
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.
A version of this test has been moved to getPractitionerCasesInteractor
.
…he tab content only for the practitioner case lists
…ton does not appear
} | ||
return ( | ||
(Case.getSortableDocketNumber(docketNumberA) || 0) - | ||
(Case.getSortableDocketNumber(docketNumberB) || 0) |
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.
🎉🎉🎉
@zachrog voiced a concern about the cypress tests using seed data, which is reasonable and a good catch. Thank you! I will put into draft mode and address. |
web-client/src/presenter/computeds/practitionerInformationHelper.test.ts
Outdated
Show resolved
Hide resolved
it.each([ | ||
[0, 0], | ||
[1, 1], | ||
[pageSize, 1], | ||
[pageSize + 1, 2], | ||
[pageSize * 2 + 1, 3], | ||
])( |
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.
Niiice!
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.
Looks good (apart from seed data perhaps)! None of my comments are of much import
cypress/local-only/tests/integration/advancedSearch/practitioner-information.cy.ts
Outdated
Show resolved
Hide resolved
…actitionerCasesInteractor
Description
This PR adds practitioner open and closed case lists for internal DAWSON users. (Ticket here)
Overview of changes:
PractitionerCaseList
component andPractitionerCaseIcons
component. (The latter can probably be extended beyond practitioners and used elsewhere? Icons seem to be rendered differently in different areas of the app.)generatePractitionerCaseListPdfInteractor
into a new interactor,getPractitionerCasesInteractor
, which is also used in the actions that set up state forPractitionerCaseList
.state.practitionerDetails
.Notes:
responseSize
number for this user in our logs: