Add tests for save and load

This commit is contained in:
Cooldude2606 committed 2025-05-12 22:00:40 +01:00
1 parent 117713eda3
commit f285d7d803
3 files changed
+169 -4

No files matched your search

+1 -2
View File
@@ -213,8 +213,7 @@ async function startControl() {
const controlConfigPath = args.config;
logger.verbose(`Loading config from ${controlConfigPath}`);
try {
const jsonConfig = JSON.parse(await fs.readFile(controlConfigPath, "utf8"));
controlConfig = lib.ControlConfig.fromJSON(jsonConfig, "control", controlConfigPath);
controlConfig = await lib.ControlConfig.fromFile("control", controlConfigPath);
} catch (err: any) {
if (err.code === "ENOENT") {
+1 -2
View File
@@ -171,8 +171,7 @@ async function startHost() {
const hostConfigPath = args.config;
logger.info(`Loading config from ${hostConfigPath}`);
try {
const jsonConfig = JSON.parse(await fs.readFile(hostConfigPath, "utf8"));
hostConfig = lib.HostConfig.fromJSON(jsonConfig, "host", hostConfigPath);
hostConfig = await lib.HostConfig.fromFile("host", hostConfigPath);
} catch (err: any) {
if (err.code === "ENOENT") {