From 47cf07346563f8062f0ef30c45066134145b5a8e Mon Sep 17 00:00:00 2001 From: nikiwycherley Date: Thu, 13 Jun 2024 09:10:02 +0100 Subject: [PATCH] fix failing unit tests --- test/plugins/rate-limit-disabled.js | 22 ++++++++++++---------- test/plugins/rate-limit.js | 11 ++++++----- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/test/plugins/rate-limit-disabled.js b/test/plugins/rate-limit-disabled.js index 90f4eddbd..11159e00f 100644 --- a/test/plugins/rate-limit-disabled.js +++ b/test/plugins/rate-limit-disabled.js @@ -73,7 +73,7 @@ lab.experiment('rate-limit plugin disabled test', () => { percentile_5: '3.5', percentile_95: '0.15', comments: '', - status: 'Closed', + status: 'Active', status_reason: '', status_date: null, coordinates: '{"type":"Point","coordinates":[-2.68044442027032,53.7529105624953]}', @@ -83,23 +83,25 @@ lab.experiment('rate-limit plugin disabled test', () => { } const fakeTelemetryData = () => [] - + const fakeThresholdData = () => [] const fakeImpactsData = () => [] const fakeWarningsAlertsData = () => [] const fakeRiverStationData = () => [] - const fakeForecastFlag = () => [{ - station_display_time_series_id: '94280', - station_id: '8208', - direction: 'u', - display_time_series: true + const fakeForecastFlag = () => { + return { + station_display_time_series_id: '94280', + station_id: '8208', + direction: 'u', + display_time_series: false + } } - ] - sandbox.stub(floodService, 'getStationById').callsFake(fakeStationData) sandbox.stub(floodService, 'getStationTelemetry').callsFake(fakeTelemetryData) - sandbox.stub(floodService, 'getImpactData').callsFake(fakeImpactsData) sandbox.stub(floodService, 'getForecastFlag').callsFake(fakeForecastFlag) + sandbox.stub(floodService, 'getStationImtdThresholds').callsFake(fakeThresholdData) + sandbox.stub(floodService, 'getImpactData').callsFake(fakeImpactsData) sandbox.stub(floodService, 'getWarningsAlertsWithinStationBuffer').callsFake(fakeWarningsAlertsData) + sandbox.stub(floodService, 'getStationById').callsFake(fakeStationData) sandbox.stub(floodService, 'getRiverStationByStationId').callsFake(fakeRiverStationData) const stationPlugin = { diff --git a/test/plugins/rate-limit.js b/test/plugins/rate-limit.js index 012b5bd94..50f9af9e2 100644 --- a/test/plugins/rate-limit.js +++ b/test/plugins/rate-limit.js @@ -79,7 +79,7 @@ lab.experiment('rate-limit plugin test', () => { percentile_5: '3.5', percentile_95: '0.15', comments: '', - status: 'Closed', + status: 'Active', status_reason: '', status_date: null, coordinates: '{"type":"Point","coordinates":[-2.68044442027032,53.7529105624953]}', @@ -89,6 +89,7 @@ lab.experiment('rate-limit plugin test', () => { } const fakeTelemetryData = () => [] + const fakeThresholdData = () => [] const fakeImpactsData = () => [] const fakeForecastFlag = () => { @@ -96,18 +97,18 @@ lab.experiment('rate-limit plugin test', () => { station_display_time_series_id: '94280', station_id: '8208', direction: 'u', - display_time_series: true + display_time_series: false } } - const fakeWarningsAlertsData = () => [] const fakeRiverStationData = () => [] - sandbox.stub(floodService, 'getStationById').callsFake(fakeStationData) sandbox.stub(floodService, 'getStationTelemetry').callsFake(fakeTelemetryData) - sandbox.stub(floodService, 'getImpactData').callsFake(fakeImpactsData) sandbox.stub(floodService, 'getForecastFlag').callsFake(fakeForecastFlag) + sandbox.stub(floodService, 'getStationImtdThresholds').callsFake(fakeThresholdData) + sandbox.stub(floodService, 'getImpactData').callsFake(fakeImpactsData) sandbox.stub(floodService, 'getWarningsAlertsWithinStationBuffer').callsFake(fakeWarningsAlertsData) + sandbox.stub(floodService, 'getStationById').callsFake(fakeStationData) sandbox.stub(floodService, 'getRiverStationByStationId').callsFake(fakeRiverStationData) const stationPlugin = {