mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 08:23:12 +09:00
Fix broken test
This commit is contained in:
1 file changed
+4
-2
@@ -534,12 +534,13 @@ describe("lib/datastore", function() {
|
|||||||
["save", new Map([...datastoreProvider.value.entries(), [value.id, value]])]
|
["save", new Map([...datastoreProvider.value.entries(), [value.id, value]])]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("sets the updatedAtMs property", function() {
|
it("sets the updatedAtMs property", async function() {
|
||||||
const value = { id: "test" };
|
const value = { id: "test" };
|
||||||
datastore.set(value);
|
datastore.set(value);
|
||||||
assert.notEqual(value.updatedAtMs, undefined);
|
assert.notEqual(value.updatedAtMs, undefined);
|
||||||
assert(value.updatedAtMs > 0, "updatedAtMs greater than zero");
|
assert(value.updatedAtMs > 0, "updatedAtMs greater than zero");
|
||||||
const prev = value.updatedAtMs;
|
const prev = value.updatedAtMs;
|
||||||
|
await lib.wait();
|
||||||
datastore.set(value);
|
datastore.set(value);
|
||||||
assert(value.updatedAtMs > prev, "updatedAtMs must increase");
|
assert(value.updatedAtMs > prev, "updatedAtMs must increase");
|
||||||
});
|
});
|
||||||
@@ -564,7 +565,7 @@ describe("lib/datastore", function() {
|
|||||||
["save", new Map([...datastoreProvider.value.entries(), ...updates.map(v => [v.id, v])])]
|
["save", new Map([...datastoreProvider.value.entries(), ...updates.map(v => [v.id, v])])]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("sets the updatedAtMs property", function() {
|
it("sets the updatedAtMs property", async function() {
|
||||||
const updates = [{ id: "test1" }, { id: "test2" }];
|
const updates = [{ id: "test1" }, { id: "test2" }];
|
||||||
datastore.setMany(updates);
|
datastore.setMany(updates);
|
||||||
assert.notEqual(updates[0].updatedAtMs, undefined);
|
assert.notEqual(updates[0].updatedAtMs, undefined);
|
||||||
@@ -572,6 +573,7 @@ describe("lib/datastore", function() {
|
|||||||
assert(updates[0].updatedAtMs > 0, "updatedAtMs greater than zero");
|
assert(updates[0].updatedAtMs > 0, "updatedAtMs greater than zero");
|
||||||
assert(updates[1].updatedAtMs > 0, "updatedAtMs greater than zero");
|
assert(updates[1].updatedAtMs > 0, "updatedAtMs greater than zero");
|
||||||
const prev = [updates[0].updatedAtMs, updates[1].updatedAtMs];
|
const prev = [updates[0].updatedAtMs, updates[1].updatedAtMs];
|
||||||
|
await lib.wait();
|
||||||
datastore.setMany(updates);
|
datastore.setMany(updates);
|
||||||
assert(updates[0].updatedAtMs > prev[0], "updatedAtMs must increase");
|
assert(updates[0].updatedAtMs > prev[0], "updatedAtMs must increase");
|
||||||
assert(updates[1].updatedAtMs > prev[1], "updatedAtMs must increase");
|
assert(updates[1].updatedAtMs > prev[1], "updatedAtMs must increase");
|
||||||
|
|||||||
Reference in new issue
Block a user