diff --git a/tests/unit/functions/weather_object_spec.js b/tests/unit/functions/weather_object_spec.js index 8878f377..c8c0faa6 100644 --- a/tests/unit/functions/weather_object_spec.js +++ b/tests/unit/functions/weather_object_spec.js @@ -1,12 +1,15 @@ const WeatherObject = require("../../../modules/default/weather/weatherobject.js"); -global.moment = require("moment"); +global.moment = require("moment-timezone"); global.SunCalc = require("suncalc"); describe("WeatherObject", function () { + let originalTimeZone; let weatherobject; beforeAll(function () { + originalTimeZone = moment.tz.guess(); + moment.tz.setDefault("Africa/Dar_es_Salaam"); weatherobject = new WeatherObject("metric", "metric", "metric", true); }); @@ -21,4 +24,8 @@ describe("WeatherObject", function () { weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327); expect(weatherobject.isDayTime()).toBe(false); }); + + afterAll(function () { + moment.tz.setDefault(originalTimeZone); + }); });