Skip to content

Commit 087a472

Browse files
committed
Fix tomezone test error as reported by @khassel
1 parent badce51 commit 087a472

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/unit/functions/weather_object_spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
const WeatherObject = require("../../../modules/default/weather/weatherobject.js");
22

3-
global.moment = require("moment");
3+
global.moment = require("moment-timezone");
44
global.SunCalc = require("suncalc");
55

66
describe("WeatherObject", function () {
7+
let originalTimeZone;
78
let weatherobject;
89

910
beforeAll(function () {
11+
originalTimeZone = moment.tz.guess();
12+
moment.tz.setDefault("Africa/Dar_es_Salaam");
1013
weatherobject = new WeatherObject("metric", "metric", "metric", true);
1114
});
1215

@@ -21,4 +24,8 @@ describe("WeatherObject", function () {
2124
weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
2225
expect(weatherobject.isDayTime()).toBe(false);
2326
});
27+
28+
afterAll(function () {
29+
moment.tz.setDefault(originalTimeZone);
30+
});
2431
});

0 commit comments

Comments
 (0)