Skip to content

Commit

Permalink
Merge pull request #645 from ministryofjustice/feature/1520-add-can-s…
Browse files Browse the repository at this point in the history
…hare-to-tracking-banner

Add accommodation sharing to tracking banner
  • Loading branch information
libuk authored Sep 21, 2023
2 parents 35149c3 + 2fad14b commit c2604e6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions cypress_shared/components/placeContextHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class PlaceContextHeaderComponent extends Component {
'contain',
`Accommodation required from: ${DateFormats.isoDateToUIDate(application.arrivalDate, { format: 'short' })}`,
)
cy.root().should('contain', 'Suitable to share: Yes')
})
}
}
4 changes: 4 additions & 0 deletions cypress_shared/fixtures/summaryData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"isAbleToShare": true,
"releaseType": "Custody"
}
3 changes: 2 additions & 1 deletion server/testutils/factories/assessment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { faker } from '@faker-js/faker/locale/en_GB'
import { Factory } from 'fishery'
import type { TemporaryAccommodationAssessment as Assessment } from '@approved-premises/api'

import summaryData from '../../../cypress_shared/fixtures/summaryData.json'
import { DateFormats } from '../../utils/dateUtils'
import { fakeObject } from '../utils'
import applicationFactory from './application'
Expand All @@ -27,7 +28,7 @@ class AssessmentFactory extends Factory<Assessment> {
export default AssessmentFactory.define(() => ({
id: faker.string.uuid(),
application: applicationFactory.withReleaseDate().build(),
summaryData: fakeObject(),
summaryData,
allocatedToStaffMemberId: faker.string.uuid(),
schemaVersion: faker.string.uuid(),
outdatedSchema: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
{% if placeContext.assessment.application.arrivalDate %}
<div>Accommodation required from: {{ formatDate(placeContext.assessment.application.arrivalDate, {format: 'short'}) }}</div>
{% endif %}
{% if placeContext.assessment.summaryData.isAbleToShare === true %}
<div>Suitable to share: Yes</div>
{% endif %}
{% if placeContext.assessment.summaryData.isAbleToShare === false %}
<div>Suitable to share: No</div>
{% endif %}
</div>
<a class="govuk-link" href="{{ addPlaceContext(paths.assessments.summary({ id: placeContext.assessment.id })) }}" rel="noreferrer noopener" target="_blank">View referral summary (opens in new tab)</a>
</div>
Expand Down

0 comments on commit c2604e6

Please sign in to comment.