Issue #2221 - Weather forecast always shows night icons in day time

This commit is contained in:
Ashish Tank
2021-01-10 16:24:46 +01:00
parent 3eda8af671
commit 2c3e8533c7
4 changed files with 1882 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

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