mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Attempted to fix remoteMap race condition, not working yet
This commit is contained in:
1 parent
f9db49734c
commit
853b7d1026
3 files changed
+78
-36
No files matched your search
+11
-9
@@ -4,8 +4,8 @@ var chunkStore = require("./chunkStore.js");
|
||||
|
||||
describe("chunkStore.js", () => {
|
||||
// define some values for our test
|
||||
const inserterX = 14.5;
|
||||
const inserterY = -7.5;
|
||||
const inserterX = 14.5; // rounds to 15
|
||||
const inserterY = -17.5; // rounds to -17, +64 would be 47
|
||||
const inserterName = "inserter";
|
||||
|
||||
let store // make our store elevated
|
||||
@@ -20,21 +20,23 @@ describe("chunkStore.js", () => {
|
||||
// nothing to do here really
|
||||
});
|
||||
});
|
||||
it("returns items located in a chunk", () => {
|
||||
it("returns items located in a chunk", (done) => {
|
||||
// We return the promise to mocha as it supports promises natively, works a lot better than calling done() manually.
|
||||
let x = 0;
|
||||
let y = -1
|
||||
return store.getChunk(x,y).then(chunkData => {
|
||||
// console.log(chunkData);
|
||||
store.getChunk(x,y).then(chunkData => {
|
||||
console.log(chunkData);
|
||||
assert.equal(typeof chunkData, "object");
|
||||
assert.equal(chunkData.get(inserterX, inserterY).name, inserterName);
|
||||
assert.equal(chunkData.dataObject[15][47].name, inserterName);
|
||||
assert.equal(chunkData.position.x, x);
|
||||
assert.equal(chunkData.position.y, y);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("deletes entities when not provided with an object as 3rd arg", () => {
|
||||
return store.setEntity(inserterX, inserterY).then((chunk)=>{
|
||||
assert(!chunk.get(inserterX, inserterY));
|
||||
it("deletes entities when not provided with an object as 3rd arg", done => {
|
||||
store.setEntity(inserterX, inserterY).then((chunk)=>{
|
||||
assert(!chunk.dataObject(15, 47));
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user