Files
factorio-clusterio/test/manual/test_settings_mod_pack.js
T
Hornwitser 4e1116ae2d Gracefully handle bad mod setting types in Web UI
Make sure all cobinations of missmatched types and missing mod settings
are gracefully handled by the Web UI.

Fixes #609.
2024-04-28 16:59:03 +02:00

29 lines
708 B
JavaScript

"use strict";
const { ModPack } = require("@clusterio/lib");
const pack = new ModPack();
pack.name = "test-settings";
pack.mods.set("test_mod", { name: "test_mod", enabled: true, version: "0.0.0" });
const settingTypes = [
"bool-setting",
"int-setting",
"double-setting",
"string-setting",
"color-setting",
];
const settingValues = {
"bool": false,
"int": 1,
"double": 0.5,
"string": "str",
"color": { r: 0, g: 1, b: 0, a: 1 },
// "missing":
};
for (const type of settingTypes) {
for (const [valueType, value] of Object.entries(settingValues)) {
pack.settings.startup.set(`${type}-with-${valueType}-value`, { value });
}
}
/* eslint-disable no-console */
console.log(pack.toModPackString());