avoid overriding config.js when running tests (#3205)

solves #3201
This commit is contained in:
Karsten Hassel
2023-09-22 14:45:46 +02:00
committed by GitHub
parent a67a0b677c
commit 95ec3096e0
9 changed files with 30 additions and 8 deletions

View File

@@ -13,7 +13,6 @@ exports.getText = async (element, result) => {
};
exports.startApp = async (configFileName, additionalMockData) => {
injectMockData(configFileName, additionalMockData);
await helpers.startApplication("");
await helpers.startApplication(injectMockData(configFileName, additionalMockData));
await helpers.getDocument();
};

View File

@@ -1,9 +1,11 @@
const helpers = require("../helpers/global-setup");
const weatherFunc = require("../helpers/weather-functions");
const { cleanupMockData } = require("../../utils/weather_mocker");
describe("Weather module", () => {
afterAll(async () => {
await helpers.stopApplication();
await cleanupMockData();
});
describe("Current weather", () => {

View File

@@ -1,9 +1,11 @@
const helpers = require("../helpers/global-setup");
const weatherFunc = require("../helpers/weather-functions");
const { cleanupMockData } = require("../../utils/weather_mocker");
describe("Weather module: Weather Forecast", () => {
afterAll(async () => {
await helpers.stopApplication();
await cleanupMockData();
});
describe("Default configuration", () => {

View File

@@ -1,9 +1,11 @@
const helpers = require("../helpers/global-setup");
const weatherFunc = require("../helpers/weather-functions");
const { cleanupMockData } = require("../../utils/weather_mocker");
describe("Weather module: Weather Hourly Forecast", () => {
afterAll(async () => {
await helpers.stopApplication();
await cleanupMockData();
});
describe("Default configuration", () => {

View File

@@ -1,3 +1,4 @@
const fs = require("fs");
const helpers = require("./helpers/global-setup");
describe("templated config with port variable", () => {
@@ -6,6 +7,11 @@ describe("templated config with port variable", () => {
});
afterAll(async () => {
await helpers.stopApplication();
try {
fs.unlinkSync("tests/configs/port_variable.js");
} catch (err) {
// do nothing
}
});
it("should return 200", async () => {