Skip to content

Commit

Permalink
Merge pull request #1167 from ministryofjustice/update-bedspaceatrrib…
Browse files Browse the repository at this point in the history
…utes

Update Bedspace search param to use new values
  • Loading branch information
aliuk2012 authored Dec 11, 2024
2 parents c8fb265 + feb3bed commit 679d407
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ export default class BedspaceSearchPage extends Page {
this.getLegend('Property attributes')
this.getLegend('Occupancy (optional)')
searchParameters.attributes
.filter(attribute => attribute === 'wheelchairAccessible')
.filter(attribute => attribute !== 'isWheelchairAccessible')
.forEach(attribute => {
this.checkCheckboxByNameAndValue('attributes[]', attribute)
})

this.getLegend('Bedspace attributes')
this.getLegend('Accessibility (optional)')
searchParameters.attributes
.filter(attribute => attribute !== 'wheelchairAccessible')
.filter(attribute => attribute === 'isWheelchairAccessible')
.forEach(attribute => {
this.checkCheckboxByNameAndValue('attributes[]', attribute)
})
Expand Down
4 changes: 2 additions & 2 deletions cypress_shared/utils/bedspaceSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export const characteristicsToSearchAttributes = (
premises: TemporaryAccommodationPremises,
): Array<BedSearchAttributes> => {
const characteristicsToSearchAttributesMap: Record<string, BedSearchAttributes> = {
'Shared property': 'sharedProperty',
'Single occupancy': 'singleOccupancy',
'Shared property': 'isSharedProperty',
'Single occupancy': 'isSingleOccupancy',
}

return premises.characteristics
Expand Down
6 changes: 5 additions & 1 deletion server/testutils/factories/bedSearchParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import {
import { DateFormats } from '../../utils/dateUtils'
import referenceData from './referenceData'

const bedSearchAttributes: Array<BedSearchAttributes> = ['singleOccupancy', 'sharedProperty', 'wheelchairAccessible']
const bedSearchAttributes: Array<BedSearchAttributes> = [
'isSingleOccupancy',
'isSharedProperty',
'isWheelchairAccessible',
]

export default Factory.define<BedSearchAPIParameters>(() => ({
startDate: DateFormats.dateObjToIsoDate(faker.date.soon()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
text: "Select all that apply"
},
items: [
{ text: "Single", value: "singleOccupancy" },
{ text: "Shared", value: "sharedProperty" }
{ text: "Single", value: "isSingleOccupancy" },
{ text: "Shared", value: "isSharedProperty" }
]
}, fetchContext()) }}
{% endcall %}
Expand All @@ -101,7 +101,7 @@
}
},
items: [
{ text: "Wheelchair accessible", value: "wheelchairAccessible" }
{ text: "Wheelchair accessible", value: "isWheelchairAccessible" }
]
}, fetchContext()) }}
{% endcall %}
Expand Down

0 comments on commit 679d407

Please sign in to comment.