Fixed Unit test case error for #2221

This commit is contained in:
Ashish Tank
2021-01-14 19:10:04 +01:00
parent 2c3e8533c7
commit 4966d6c920
3 changed files with 21 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
/* eslint no-multi-spaces: 0 */
const expect = require("chai").expect;
const moment = require("moment-timezone");
var data = require("../functions/weatherforecast_data.json");
describe("Functions module weatherforecast", function () {
@@ -69,6 +70,16 @@ describe("Functions module weatherforecast", function () {
Log = {
error: function () {}
};
var originalLocale;
var originalTimeZone;
before(function () {
originalLocale = moment.locale();
originalTimeZone = moment.tz.guess();
moment.locale("hi");
moment.tz.setDefault("Europe/Warsaw");
});
describe("forecastIcons sunset specified", function () {
before(function () {
Module.definitions.weatherforecast.Log = {};
@@ -97,5 +108,10 @@ describe("Functions module weatherforecast", function () {
expect(forecastData[2].icon).to.equal("wi-rain");
});
});
after(function () {
moment.locale(originalLocale);
moment.tz.setDefault(originalTimeZone);
});
});
});