mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 21:00:57 +00:00
Issue #2221 - Weather forecast always shows night icons in day time
This commit is contained in:
1838
tests/unit/functions/weatherforecast_data.json
Normal file
1838
tests/unit/functions/weatherforecast_data.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
/* eslint no-multi-spaces: 0 */
|
||||
const expect = require("chai").expect;
|
||||
var data = require("../functions/weatherforecast_data.json");
|
||||
|
||||
describe("Functions module weatherforecast", function () {
|
||||
before(function () {
|
||||
@@ -63,4 +64,38 @@ describe("Functions module weatherforecast", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("forecastIcons", function () {
|
||||
Log = {
|
||||
error: function () {}
|
||||
};
|
||||
describe("forecastIcons sunset specified", function () {
|
||||
before(function () {
|
||||
Module.definitions.weatherforecast.Log = {};
|
||||
Module.definitions.weatherforecast.forecast = [];
|
||||
Module.definitions.weatherforecast.show = Module.definitions.weatherforecast.updateDom = function () {};
|
||||
Module.definitions.weatherforecast.config = Module.definitions.weatherforecast.defaults;
|
||||
});
|
||||
|
||||
it(`returns correct icons with sunset time`, function () {
|
||||
Module.definitions.weatherforecast.processWeather(data.withSunset);
|
||||
let forecastData = Module.definitions.weatherforecast.forecast;
|
||||
expect(forecastData.length).to.equal(4);
|
||||
expect(forecastData[2].icon).to.equal("wi-rain");
|
||||
});
|
||||
});
|
||||
|
||||
describe("forecastIcons sunset not specified", function () {
|
||||
before(function () {
|
||||
Module.definitions.weatherforecast.forecast = [];
|
||||
});
|
||||
|
||||
it(`returns correct icons with out sunset time`, function () {
|
||||
Module.definitions.weatherforecast.processWeather(data.withoutSunset);
|
||||
let forecastData = Module.definitions.weatherforecast.forecast;
|
||||
expect(forecastData.length).to.equal(4);
|
||||
expect(forecastData[2].icon).to.equal("wi-rain");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user