Merge pull request #2650 from rejas/weather

This commit is contained in:
Michael Teeuw
2021-09-09 20:30:37 +02:00
committed by GitHub
9 changed files with 55 additions and 188 deletions

View File

@@ -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);
});
});