mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 07:24:52 +09:00
Add and fix tests
This commit is contained in:
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
@@ -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"],
|
||||
]));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -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"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user