diff --git a/js/logger.js b/js/logger.js index 7c802924..18aa9175 100644 --- a/js/logger.js +++ b/js/logger.js @@ -35,6 +35,7 @@ timeEnd: Function.prototype.bind.call(console.timeEnd, console) }; + // the timeStamp instruction fails when running the tests so it is not added in test environment if (process.env.NODE_ENV.trim() !== "test") { logLevel.push({ timeStamp: Function.prototype.bind.call(console.timeStamp, console) }); } diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 23f50d49..50229262 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -340,12 +340,8 @@ Module.register("weatherforecast", { * argument data object - Weather information received form openweather.org. */ processWeather: function (data, momenttz) { - let mom; - if (momenttz === null) { - mom = moment; - } else { - mom = momenttz; - } + let mom = momenttz ? momenttz : moment; // Exception last. + // Forcast16 (paid) API endpoint provides this data. Onecall endpoint // does not. if (data.city) { @@ -489,12 +485,8 @@ Module.register("weatherforecast", { * This code finds all forecasts that is for the same day and sums the amount of rain and returns that. */ processRain: function (forecast, allForecasts, momenttz) { - let mom; - if (momenttz === null) { - mom = moment; - } else { - mom = momenttz; - } + let mom = momenttz ? momenttz : moment; // Exception last. + //If the amount of rain actually is a number, return it if (!isNaN(forecast.rain)) { return forecast.rain;