mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-27 00:37:14 +09:00
Fix migration tests
This commit is contained in:
1 file changed
+21
-1
@@ -315,9 +315,29 @@ describe("controller/src/Controller", function() {
|
|||||||
assert.equal(result[1].restartRequired, true);
|
assert.equal(result[1].restartRequired, true);
|
||||||
assert.equal(result[2].restartRequired, false);
|
assert.equal(result[2].restartRequired, false);
|
||||||
});
|
});
|
||||||
|
it("migrates 'systemStartedAtMs' from undefined to Date.now", function() { // Alpha 23
|
||||||
|
const result = Controller.migrateSystems([
|
||||||
|
{}, { systemStartedAtMs: 0 }, { systemStartedAtMs: 500 },
|
||||||
|
]);
|
||||||
|
const now = Date.now();
|
||||||
|
const r0 = result[0].systemStartedAtMs;
|
||||||
|
assert.ok(r0 > now - 100 && r0 <= now);
|
||||||
|
assert.equal(result[1].systemStartedAtMs, 0);
|
||||||
|
assert.equal(result[2].systemStartedAtMs, 500);
|
||||||
|
});
|
||||||
|
it("migrates 'processStartedAtMs' from undefined to Date.now", function() { // Alpha 23
|
||||||
|
const result = Controller.migrateSystems([
|
||||||
|
{}, { processStartedAtMs: 0 }, { processStartedAtMs: 500 },
|
||||||
|
]);
|
||||||
|
const now = Date.now();
|
||||||
|
const r0 = result[0].processStartedAtMs;
|
||||||
|
assert.ok(r0 > now - 100 && r0 <= now);
|
||||||
|
assert.equal(result[1].processStartedAtMs, 0);
|
||||||
|
assert.equal(result[2].processStartedAtMs, 500);
|
||||||
|
});
|
||||||
it("does nothing for upto date data", function() {
|
it("does nothing for upto date data", function() {
|
||||||
const systemInfo = new SystemInfo(
|
const systemInfo = new SystemInfo(
|
||||||
1, "name", "n", "k", "m", "cm", "cr", "mc", "ma", "dc", "da", false, false, 0, false
|
1, "name", "n", "k", "m", "cm", "cr", "mc", "ma", "dc", "da", false, false, 0, 0, 0, false
|
||||||
);
|
);
|
||||||
const jsonString = JSON.stringify(systemInfo);
|
const jsonString = JSON.stringify(systemInfo);
|
||||||
const systemInfoJson = JSON.parse(jsonString);
|
const systemInfoJson = JSON.parse(jsonString);
|
||||||
|
|||||||
Reference in new issue
Block a user