Skip to content
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

handle absent nextReviewDate on csra summary page #315

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/controllers/csraController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('CSRA Controller', () => {

it('should handle details not being present', async () => {
jest.spyOn<any, string>(controller['csraService'], 'getCsraAssessment').mockResolvedValue({
csraAssessment: { ...csraAssessmentMock, assessmentComment: '' },
csraAssessment: { ...csraAssessmentMock, assessmentComment: '', nextReviewDate: undefined },
agencyDetails: { ...AgencyMock, description: '' },
staffDetails: StaffDetailsMock,
})
Expand All @@ -224,7 +224,7 @@ describe('CSRA Controller', () => {
{ key: { text: 'Reviewed by' }, value: { text: 'Reception - John Smith' } },
{
key: { text: 'Next review date' },
value: { text: '13 January 2018' },
value: { text: 'Not entered' },
},
]

Expand Down Expand Up @@ -379,7 +379,7 @@ describe('CSRA Controller', () => {
])
})

it('should return ther filtered assessments', async () => {
it('should return the filtered assessments', async () => {
const reqWithQuery = {
...req,
query: {
Expand Down
4 changes: 3 additions & 1 deletion server/mappers/csraReviewToSummaryListMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export default (
{
key: { text: 'Next review date' },
value: {
text: formatDate(new Date(csraAssessment.nextReviewDate).toISOString(), 'long'),
text: csraAssessment.nextReviewDate
? formatDate(new Date(csraAssessment.nextReviewDate).toISOString(), 'long')
Copy link
Contributor

Choose a reason for hiding this comment

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

nextReviewDate should be an ISO date already so no need to go string->Date->string

: 'Not entered',
},
},
]
Expand Down