From 46fdeefa1455a673f67f6524fb9de9f3f003257f Mon Sep 17 00:00:00 2001 From: Cillian O'Ruanaidh Date: Fri, 24 May 2024 11:24:57 +0100 Subject: [PATCH] Make sure OSM map is not enabled in test environment in case it abuses OSM tile servers --- app/webpacker/controllers/open_street_map_controller.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/webpacker/controllers/open_street_map_controller.js b/app/webpacker/controllers/open_street_map_controller.js index 0c5f983158..38103565df 100644 --- a/app/webpacker/controllers/open_street_map_controller.js +++ b/app/webpacker/controllers/open_street_map_controller.js @@ -71,6 +71,11 @@ export default class extends Controller { } #displayMap() { + // Don't initialise map in test environment because that could possibly abuse OSM tile servers + if(process.env.RAILS_ENV == "test") { + return false; + } + this.map = L.map('open-street-map') L.tileLayer.provider(this.providerNameValue, this.providerOptionsValue).addTo(this.map) this.map.setView([this.defaultLatitudeValue, this.defaultLongitudeValue], this.zoomLevel)