Skip to content

Commit

Permalink
Merge pull request #2268 from ministryofjustice/bugfix/APS-1705_Defau…
Browse files Browse the repository at this point in the history
…lt_keyworker_to_Not-assigned

APS-1705 Default key-worker to 'Not assigned' on the premises view page placement list
  • Loading branch information
bobmeredith authored Dec 24, 2024
2 parents 16e4b90 + 02b58f7 commit 589a4c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions server/utils/premises/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ describe('premisesUtils', () => {
])
})

it('should select the option whose id maches the premisesId field in the context', () => {
it('should select the option whose id matches the premisesId field in the context', () => {
expect(
groupCas1SummaryPremisesSelectOptions(premises, { premisesId: area1Premises[0].id })[0].items[0].selected,
).toBeTruthy()
})
it('should select the option whose id maches the specified field in the context', () => {
it('should select the option whose id matches the specified field in the context', () => {
expect(
groupCas1SummaryPremisesSelectOptions(premises, { premises: area2Premises[1].id }, 'premises')[1].items[1]
.selected,
Expand All @@ -119,7 +119,7 @@ describe('premisesUtils', () => {
},
])
})
it('should select the option whose id maches the specfied field in the context', () => {
it('should select the option whose id matches the specfied field in the context', () => {
expect(
cas1PremisesSummaryRadioOptions(premises, { premises: premises[1].id }, 'premises')[1].selected,
).toBeTruthy()
Expand Down Expand Up @@ -266,6 +266,7 @@ describe('premisesUtils', () => {
const placements = [
...cas1SpaceBookingSummaryFactory.buildList(3, { tier: 'A' }),
cas1SpaceBookingSummaryFactory.build({ tier: 'A', status: undefined }),
cas1SpaceBookingSummaryFactory.build({ tier: 'A', keyWorkerAllocation: undefined }),
]

const tableRows = placementTableRows(activeTab, 'Test_Premises_Id', placements)
Expand All @@ -281,7 +282,7 @@ describe('premisesUtils', () => {
]
return activeTab === 'historic'
? [...baseColumns, statusColumn]
: [...baseColumns, { text: placement.keyWorkerAllocation.keyWorker.name }, statusColumn]
: [...baseColumns, { text: placement.keyWorkerAllocation?.keyWorker?.name || 'Not assigned' }, statusColumn]
})
expect(tableRows).toEqual(expectedRows)
},
Expand Down
2 changes: 1 addition & 1 deletion server/utils/premises/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const placementTableRows = (
tier: htmlValue(getTierOrBlank(tier)),
canonicalArrivalDate: textValue(DateFormats.isoDateToUIDate(canonicalArrivalDate, { format: 'short' })),
canonicalDepartureDate: textValue(DateFormats.isoDateToUIDate(canonicalDepartureDate, { format: 'short' })),
keyWorkerName: textValue(keyWorkerAllocation?.keyWorker?.name),
keyWorkerName: textValue(keyWorkerAllocation?.keyWorker?.name || 'Not assigned'),
status: textValue(statusTextMap[status]),
}
return columnMap[activeTab].map(({ fieldName }: ColumnDefinition) => fieldValues[fieldName])
Expand Down

0 comments on commit 589a4c0

Please sign in to comment.