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:
Hornwitser committed 2020-05-26 01:11:49 +02:00
1 parent d1b851d890
commit 260f976fa3
28 files changed
+642 -247

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
const assert = require("assert").strict;
const path = require("path");
const factorio = require("lib/factorio");
describe("Integration of lib/factorio/export", function() {
describe("exportLocale()", function() {
it("returns a nested Map with base game locale information", async function() {
let writePath = path.join("temp", "test", "server");
let testServer = new factorio.FactorioServer("factorio", writePath, {});
await testServer.init();
let locale = await factorio._exportLocale(testServer, new Map(), ["base"], "en");
assert(locale instanceof Map, "locale is not a map");
assert.equal(locale.get("entity-name.fish"), "Fish");
assert.equal(locale.get("entity-name.small-lamp"), "Lamp");
let empty_keys = 0;
for (let [key, value] of locale) {
// key is always a string
assert.equal(typeof key, "string");
// Value is always a string, nearly always truthy
if (!value) {
empty_keys++;
}
assert.equal(typeof value, "string");
}
assert(empty_keys < 10, `Got unusually high amount (${empty_keys}) of empty keys`);
});
});
});