Add and fix tests

This commit is contained in:
Cooldude2606 committed 2024-11-13 22:17:27 +00:00
1 parent 81444cc447
commit 3850558d49
8 files changed
+60 -15

No files matched your search

@@ -1,4 +1,4 @@
; Test data for exportLocale
[test]
key-a=1
key-b=2
base-a=1
base-b=2
+10 -1
View File
@@ -17,7 +17,16 @@ describe("host/src/export", function() {
it("returns a flattened mapping with locale definitions", async function() {
let locale = await _exportLocale(testServer, new Map(), ["base"], "en");
assert.deepEqual(locale, new Map([["test.key-a", "1"], ["test.key-b", "2"]]));
assert.deepEqual(locale, new Map([
["test.core-a", "1"], ["test.core-b", "2"],
["test.base-a", "1"], ["test.base-b", "2"],
]));
});
it("returns a filtered locale definitions based on mod order", async function() {
let locale = await _exportLocale(testServer, new Map(), [], "en");
assert.deepEqual(locale, new Map([
["test.core-a", "1"], ["test.core-b", "2"],
]));
});
});
});
+27
View File
@@ -378,5 +378,32 @@ describe("lib/data/ModPack", function() {
/* eslint-enable indent */
});
});
describe("getBuiltinMods()", function() {
it("should work with versions before 2.0", function() {
const builtinMods = ModPack.getBuiltinMods("1.1");
assert.deepEqual(builtinMods, [
{ name: "base", enabled: true, version: "1.1" },
]);
});
it("should work with versions after 2.0", function() {
const builtinMods = ModPack.getBuiltinMods("2.0");
assert.deepEqual(builtinMods, [
{ name: "base", enabled: true, version: "2.0" },
{ name: "elevated-rails", enabled: false, version: "2.0" },
{ name: "quality", enabled: false, version: "2.0" },
{ name: "space-age", enabled: false, version: "2.0" },
]);
});
});
describe("getBuiltinModNames()", function() {
it("should work with versions before 2.0", function() {
const builtinModNames = ModPack.getBuiltinModNames("1.1");
assert.deepEqual(builtinModNames, ["base"]);
});
it("should work with versions after 2.0", function() {
const builtinModNames = ModPack.getBuiltinModNames("2.0");
assert.deepEqual(builtinModNames, ["base", "elevated-rails", "quality", "space-age"]);
});
});
});
});