Use es6 notation in tests

This commit is contained in:
rejas
2021-04-08 21:12:56 +02:00
parent 6eba8d681c
commit d736dd92be
23 changed files with 36 additions and 53 deletions

View File

@@ -4,7 +4,7 @@ const colors = require("colors/safe");
describe("Utils", function () {
describe("colors", function () {
var colorsEnabled = colors.enabled;
const colorsEnabled = colors.enabled;
afterEach(function () {
colors.enabled = colorsEnabled;

View File

@@ -21,7 +21,7 @@ describe("Functions module currentweather", function () {
Module.definitions.currentweather.config.roundTemp = true;
});
var values = [
const values = [
// index 0 value
// index 1 expect
[1, "1"],
@@ -45,7 +45,7 @@ describe("Functions module currentweather", function () {
Module.definitions.currentweather.config.roundTemp = false;
});
var values = [
const values = [
// index 0 value
// index 1 expect
[1, "1.0"],

View File

@@ -1,7 +1,7 @@
/* eslint no-multi-spaces: 0 */
const expect = require("chai").expect;
const moment = require("moment-timezone");
var data = require("../functions/weatherforecast_data.json");
const data = require("../functions/weatherforecast_data.json");
describe("Functions module weatherforecast", function () {
before(function () {
@@ -21,7 +21,7 @@ describe("Functions module weatherforecast", function () {
Module.definitions.weatherforecast.config.roundTemp = true;
});
var values = [
const values = [
// index 0 value
// index 1 expect
[1, "1"],
@@ -45,7 +45,7 @@ describe("Functions module weatherforecast", function () {
Module.definitions.weatherforecast.config.roundTemp = false;
});
var values = [
const values = [
// index 0 value
// index 1 expect
[1, "1.0"],
@@ -71,8 +71,8 @@ describe("Functions module weatherforecast", function () {
error: function () {}
};
var originalLocale;
var originalTimeZone;
let originalLocale;
let originalTimeZone;
before(function () {
originalLocale = moment.locale();
originalTimeZone = moment.tz.guess();

View File

@@ -4,11 +4,11 @@ const expect = require("chai").expect;
const vm = require("vm");
before(function () {
var basedir = path.join(__dirname, "../../..");
const basedir = path.join(__dirname, "../../..");
var fileName = "js/app.js";
var filePath = path.join(basedir, fileName);
var code = fs.readFileSync(filePath);
const fileName = "js/app.js";
const filePath = path.join(basedir, fileName);
const code = fs.readFileSync(filePath);
this.sandbox = {
module: {},
@@ -41,7 +41,7 @@ after(function () {
});
describe("'global.root_path' set in js/app.js", function () {
var expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"];
const expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"];
expectedSubPaths.forEach((subpath) => {
it(`contains a file/folder "${subpath}"`, function () {