Skip to content

Commit

Permalink
remove setConfig in openweathermap.js, add weatherProvider and weathe…
Browse files Browse the repository at this point in the history
…rEndpoint to all weather test configs
  • Loading branch information
khassel committed Oct 10, 2024
1 parent 2902a3b commit 45f04bc
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 26 deletions.
21 changes: 0 additions & 21 deletions modules/default/weather/providers/openweathermap.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,6 @@ WeatherProvider.register("openweathermap", {
.finally(() => this.updateAvailable());
},

/**
* Overrides method for setting config to check if endpoint is correct for hourly
* @param {object} config The configuration object
*/
setConfig (config) {
this.config = config;
if (!this.config.weatherEndpoint) {
switch (this.config.type) {
case "hourly":
case "daily":
case "forecast":
case "current":
case "":
this.config.weatherEndpoint = "/onecall";
break;
default:
Log.error("weatherEndpoint not configured and could not resolve it based on type");
}
}
},

/** OpenWeatherMap Specific Methods - These are not part of the default provider methods */
/*
* Gets the complete url for the request
Expand Down
2 changes: 2 additions & 0 deletions tests/configs/modules/weather/currentweather_compliments.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ let config = {
position: "bottom_bar",
config: {
location: "Munich",
weatherProvider: "openweathermap",
weatherEndpoint: "/weather",
mockData: '"#####WEATHERDATA#####"'
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/configs/modules/weather/currentweather_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let config = {
config: {
location: "Munich",
showHumidity: "feelslike",
weatherProvider: "openweathermap",
weatherEndpoint: "/weather",
mockData: '"#####WEATHERDATA#####"'
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/configs/modules/weather/currentweather_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ let config = {
position: "bottom_bar",
config: {
location: "Munich",
weatherProvider: "openweathermap",
weatherEndpoint: "/weather",
mockData: '"#####WEATHERDATA#####"',
windUnits: "beaufort",
showWindDirectionAsArrow: true,
Expand Down
2 changes: 2 additions & 0 deletions tests/configs/modules/weather/currentweather_units.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let config = {
position: "bottom_bar",
config: {
location: "Munich",
weatherProvider: "openweathermap",
weatherEndpoint: "/weather",
mockData: '"#####WEATHERDATA#####"',
decimalSymbol: ",",
showHumidity: "wind"
Expand Down
3 changes: 2 additions & 1 deletion tests/configs/modules/weather/forecastweather_absolute.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ let config = {
config: {
type: "forecast",
location: "Munich",
mockData: '"#####WEATHERDATA#####"',
weatherProvider: "openweathermap",
weatherEndpoint: "/forecast/daily",
mockData: '"#####WEATHERDATA#####"',
absoluteDates: true
}
}
Expand Down
5 changes: 3 additions & 2 deletions tests/configs/modules/weather/forecastweather_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ let config = {
config: {
type: "forecast",
location: "Munich",
mockData: '"#####WEATHERDATA#####"',
weatherEndpoint: "/forecast/daily"
weatherProvider: "openweathermap",
weatherEndpoint: "/forecast/daily",
mockData: '"#####WEATHERDATA#####"'
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion tests/configs/modules/weather/forecastweather_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ let config = {
config: {
type: "forecast",
location: "Munich",
mockData: '"#####WEATHERDATA#####"',
weatherProvider: "openweathermap",
weatherEndpoint: "/forecast/daily",
mockData: '"#####WEATHERDATA#####"',
showPrecipitationAmount: true,
colored: true,
tableClass: "myTableClass"
Expand Down
3 changes: 2 additions & 1 deletion tests/configs/modules/weather/forecastweather_units.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ let config = {
config: {
type: "forecast",
location: "Munich",
mockData: '"#####WEATHERDATA#####"',
weatherProvider: "openweathermap",
weatherEndpoint: "/forecast/daily",
mockData: '"#####WEATHERDATA#####"',
decimalSymbol: "_",
showPrecipitationAmount: true
}
Expand Down
2 changes: 2 additions & 0 deletions tests/configs/modules/weather/hourlyweather_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let config = {
config: {
type: "hourly",
location: "Berlin",
weatherProvider: "openweathermap",
weatherEndpoint: "/onecall",
mockData: '"#####WEATHERDATA#####"'
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/configs/modules/weather/hourlyweather_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let config = {
config: {
type: "hourly",
location: "Berlin",
weatherProvider: "openweathermap",
weatherEndpoint: "/onecall",
mockData: '"#####WEATHERDATA#####"',
hourlyForecastIncrements: 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let config = {
config: {
type: "hourly",
location: "Berlin",
weatherProvider: "openweathermap",
weatherEndpoint: "/onecall",
mockData: '"#####WEATHERDATA#####"',
showPrecipitationAmount: true,
showPrecipitationProbability: true
Expand Down

0 comments on commit 45f04bc

Please sign in to comment.