Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

weather_object_spec.js 973B

12345678910111213141516171819202122232425262728293031
  1. const WeatherObject = require("../../../modules/default/weather/weatherobject.js");
  2. global.moment = require("moment-timezone");
  3. global.SunCalc = require("suncalc");
  4. describe("WeatherObject", function () {
  5. let originalTimeZone;
  6. let weatherobject;
  7. beforeAll(function () {
  8. originalTimeZone = moment.tz.guess();
  9. moment.tz.setDefault("Africa/Dar_es_Salaam");
  10. weatherobject = new WeatherObject("metric", "metric", "metric", true);
  11. });
  12. it("should return true for daytime at noon", function () {
  13. weatherobject.date = moment(12, "HH");
  14. weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
  15. expect(weatherobject.isDayTime()).toBe(true);
  16. });
  17. it("should return false for daytime at midnight", function () {
  18. weatherobject.date = moment(0, "HH");
  19. weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
  20. expect(weatherobject.isDayTime()).toBe(false);
  21. });
  22. afterAll(function () {
  23. moment.tz.setDefault(originalTimeZone);
  24. });
  25. });