mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 15:30:41 +09:00
Implement export of item icons and locale
Add mod and command for exporting the Factorio locale including mods, and item icons assemled into a sprite sheet including mods.
This commit is contained in:
1 parent
d1b851d890
commit
260f976fa3
28 files changed
+642
-247
No files matched your search
@@ -0,0 +1,21 @@
|
||||
const assert = require("assert").strict;
|
||||
const path = require("path");
|
||||
|
||||
const factorio = require("lib/factorio");
|
||||
|
||||
|
||||
describe("lib/factorio/export", function() {
|
||||
describe("exportLocale()", function() {
|
||||
let testServer;
|
||||
before(async function() {
|
||||
let writePath = path.join("temp", "test", "server");
|
||||
testServer = new factorio.FactorioServer(path.join("test", "file", "factorio"), writePath, {});
|
||||
await testServer.init();
|
||||
});
|
||||
|
||||
it("returns a flattened mapping with locale definitions", async function() {
|
||||
let locale = await factorio._exportLocale(testServer, new Map(), ["base"], "en");
|
||||
assert.deepEqual(locale, new Map([["test.key-a", "1"], ["test.key-b", "2"]]));
|
||||
});
|
||||
});;
|
||||
});
|
||||
@@ -1,18 +0,0 @@
|
||||
const assert = require("assert").strict;
|
||||
const path = require("path");
|
||||
|
||||
const factorio = require("lib/factorio");
|
||||
|
||||
|
||||
describe("lib/factorio/locale", function() {
|
||||
describe("getLocale()", function() {
|
||||
it("verifies types of the arguments", async function() {
|
||||
await assert.rejects(factorio.getLocale(1, "a"), new TypeError("dataDir must be a string"));
|
||||
await assert.rejects(factorio.getLocale("a", 1), new TypeError("languageCode must be a string"));
|
||||
});
|
||||
it("returns a nested object with locale definitions", async function() {
|
||||
let locale = await factorio.getLocale(path.join("test", "file", "factorio", "data"), "en");
|
||||
assert.deepEqual(locale, { test: { "key-a": "1", "key-b": "2" } });
|
||||
});
|
||||
});;
|
||||
});
|
||||
Reference in new issue
Block a user