Skip to content

Commit

Permalink
fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nikiwycherley committed Aug 7, 2024
1 parent 4d870bb commit 47cf073
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
22 changes: 12 additions & 10 deletions test/plugins/rate-limit-disabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]}',
Expand All @@ -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 = {
Expand Down
11 changes: 6 additions & 5 deletions test/plugins/rate-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]}',
Expand All @@ -89,25 +89,26 @@ lab.experiment('rate-limit plugin test', () => {
}

const fakeTelemetryData = () => []
const fakeThresholdData = () => []

const fakeImpactsData = () => []
const fakeForecastFlag = () => {
return {
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 = {
Expand Down

0 comments on commit 47cf073

Please sign in to comment.