mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
Add tests for new methods
This commit is contained in:
24
tests/unit/functions/weather_object_spec.js
Normal file
24
tests/unit/functions/weather_object_spec.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const WeatherObject = require("../../../modules/default/weather/weatherobject.js");
|
||||
|
||||
global.moment = require("moment");
|
||||
global.SunCalc = require("suncalc");
|
||||
|
||||
describe("WeatherObject", function () {
|
||||
let weatherobject;
|
||||
|
||||
beforeAll(function () {
|
||||
weatherobject = new WeatherObject("metric", "metric", "metric", true);
|
||||
});
|
||||
|
||||
it("should return true for daytime at noon", function () {
|
||||
weatherobject.date = moment(12, "HH");
|
||||
weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
|
||||
expect(weatherobject.isDayTime()).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for daytime at midnight", function () {
|
||||
weatherobject.date = moment(0, "HH");
|
||||
weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
|
||||
expect(weatherobject.isDayTime()).toBe(false);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user