Skip to content
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
35 changes: 35 additions & 0 deletions server/routes/__tests__/results.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,38 @@ describe('Results page', () => {
expect(pageContent.siteDrawnSize).toEqual(false)
})

it('should rivers and sea climate change bullet point when no data climate change zone only', async () => {
getPsoContactsByPolygon.mockResolvedValue({
isEngland: true,
EmailAddress: 'emdenquiries@environment-agency.gov.uk',
AreaName: 'East Midlands',
useAutomatedService: true,
LocalAuthorities: 'Derbyshire Dales'
})
getFloodDataByPolygon.mockResolvedValue({
floodzone_2: false,
floodzone_3: false,
floodZone: '1',
floodZoneLevel: 'low',
floodZoneClimateChange: true,
floodZoneClimateChangeNoData: true,
surfaceWater: {
riskBandId: -1,
riskBand: false,
riskBandPercent: null,
riskBandOdds: null
},
isRiskAdminArea: false,
hasSeaSource: false,
hasRiversSource: false,
floodSource: 'Unavailable'
})
getAreaInHectaresSpy.mockReturnValue(0)
const response = await submitGetRequest({ url: `${url}?${getUniquePolygonQuery()}` })
const pageContent = getElementByIdAndFormat(response.payload)
expect(pageContent.riversAndSeaCCNoDataBulletPoint).toEqual(riversAndSeaCCNoDataBulletPointText)
})

it('should show RS title and bullet point, zone 1 relevant text (no FRA) when admin console updated area', async () => {
getPsoContactsByPolygon.mockResolvedValue({
isEngland: true,
Expand Down Expand Up @@ -728,6 +760,7 @@ const riversBulletPointText = 'rivers (fluvial)'
const seaBulletPointText = 'the sea (tidal)'
const riversAndSeaBulletPointText = 'rivers and the sea (fluvial and tidal)'
const swBulletPointText = 'surface water'
const riversAndSeaCCNoDataBulletPointText = 'rivers and the sea (fluvial or tidal) due to climate change'
const fz1DataUnlikelyText = 'Your site is in flood zone 1, so it\'s unlikely we\'ll have any flood risk data for it. You can place an order and we\'ll email you if none is available.'
const rsSummaryTitleText = 'Rivers and the sea'
const orderP4ButtonText = 'Order flood risk data'
Expand Down Expand Up @@ -759,6 +792,7 @@ const getElementByIdAndFormat = (payload) => {
const riversAndSeaBulletPoint = document.getElementById('riversAndSeaBulletPoint') ? removeHtmlGaps(document.getElementById('riversAndSeaBulletPoint').textContent) : false
const riversBulletPoint = document.getElementById('riversBulletPoint') ? removeHtmlGaps(document.getElementById('riversBulletPoint').textContent) : false
const seaBulletPoint = document.getElementById('seaBulletPoint') ? removeHtmlGaps(document.getElementById('seaBulletPoint').textContent) : false
const riversAndSeaCCNoDataBulletPoint = document.getElementById('riversAndSeaNoDataBulletPoint') ? removeHtmlGaps(document.getElementById('riversAndSeaNoDataBulletPoint').textContent) : false
const fz1DataUnlikely = document.getElementById('fz1DataUnlikely') ? removeHtmlGaps(document.getElementById('fz1DataUnlikely').textContent) : false
const rsSummaryTitle = removeHtmlGaps(document.getElementById('rsSummaryTitle').textContent)
const orderP4Button = document.getElementById('orderP4Button') ? removeHtmlGaps(document.getElementById('orderP4Button').textContent) : false
Expand Down Expand Up @@ -790,6 +824,7 @@ const getElementByIdAndFormat = (payload) => {
riversBulletPoint,
seaBulletPoint,
swBulletPoint,
riversAndSeaCCNoDataBulletPoint,
fz1DataUnlikely,
rsSummaryTitle,
orderP4Button,
Expand Down
3 changes: 2 additions & 1 deletion server/views/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ <h1 id="heading" class="govuk-heading-xl">{{ pageTitle }}</h1>
<ul class="govuk-list govuk-list--bullet">
{% if floodData.hasRiversSource and floodData.hasSeaSource %}<li id="riversAndSeaBulletPoint" data-testid="risk-list-rivers-sea">rivers and the sea (fluvial and tidal)</li>
{% elif floodData.hasRiversSource %}<li id="riversBulletPoint" data-testid="risk-list-rivers">rivers (fluvial)</li>
{% elif floodData.hasSeaSource %}<li id="seaBulletPoint" data-testid="risk-list-sea">the sea (tidal)</li>{% endif %}
{% elif floodData.hasSeaSource %}<li id="seaBulletPoint" data-testid="risk-list-sea">the sea (tidal)</li>
{% elif floodData.floodZoneClimateChangeNoData %}<li id="riversAndSeaNoDataBulletPoint" data-testid="risk-list-rivers-sea-no-data">rivers and the sea (fluvial or tidal) due to climate change</li>{% endif %}
{% if floodData.surfaceWater.riskBand %}<li id="swBulletPoint">surface water</li>{% endif %}
</ul>
{% endif %}
Expand Down
Loading