mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
still trying to fix paths
This commit is contained in:
1 parent
9a0ce97746
commit
dfa5d9ad16
3 files changed
+20
-8
No files matched your search
+9
-3
@@ -2,6 +2,8 @@ const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const appRootPath = require("app-root-path");
|
||||
|
||||
const factorioServer = require("./index.js");
|
||||
|
||||
describe("factorioServer/index.js", ()=>{
|
||||
@@ -53,15 +55,19 @@ describe("factorioServer/index.js", ()=>{
|
||||
});
|
||||
describe(".createMap()", ()=>{
|
||||
it("creates a map file as instanceDirectory/saves/map.zip", async ()=>{
|
||||
let relativePath = __dirname.replace(appRootPath, "").substr(1);
|
||||
let server = new factorioServer({
|
||||
instanceDirectory: path.resolve(__dirname, "_testData_createMap"),
|
||||
instanceDirectory: path.resolve(appRootPath+"", relativePath, "_testData_createMap"),
|
||||
instanceName: "Unit testing instance",
|
||||
});
|
||||
await server.initialize();
|
||||
let maps = fs.readdirSync(path.resolve(__dirname, "_testData_createMap", "saves"));
|
||||
console.log(appRootPath+"")
|
||||
console.log(relativePath)
|
||||
console.log(path.resolve(appRootPath+"", relativePath, "_testData_createMap", "saves"))
|
||||
let maps = fs.readdirSync(path.resolve(appRootPath+"", relativePath, "_testData_createMap", "saves"));
|
||||
assert.equal(maps.length, 0);
|
||||
await server.createMap();
|
||||
let maps2 = fs.readdirSync(path.resolve(__dirname, "_testData_createMap", "saves"));
|
||||
let maps2 = fs.readdirSync(path.resolve(appRootPath+"", relativePath, "_testData_createMap", "saves"));
|
||||
assert(maps2.includes("map.zip"));
|
||||
|
||||
server.deleteInstance();
|
||||
|
||||
Reference in new issue
Block a user