Remove tests that pin implementation details

Drops tests that restate message declarations, check that removed
commands are gone, test internal helpers or repeat the same behaviour
at another layer.
This commit is contained in:
Danielv123 committed 2026-10-30 10:11:14 +01:00
1 parent 87d4f5c64e
commit 37e79d9c41
10 files changed
+1 -464

No files matched your search

-67
View File
@@ -1,4 +1,3 @@
import assert from "node:assert/strict";
import { HostPairingDetails } from "@clusterio/lib";
import { testMatrix, testRoundTripJsonSerialisable } from "../../common.js";
@@ -16,70 +15,4 @@ describe("lib/data/HostPairingDetails", function () {
[undefined, true], // isDeleted
));
});
describe("constructor", function () {
it("should set defaults correctly", function () {
const details = new HostPairingDetails("ABC-DEF", "New Host", "10.0.0.1");
assert.equal(details.code, "ABC-DEF");
assert.equal(details.name, "New Host");
assert.equal(details.remoteAddress, "10.0.0.1");
assert.equal(details.version, "");
assert.equal(details.createdAtMs, 0);
assert.equal(details.updatedAtMs, 0);
assert.equal(details.isDeleted, false);
});
it("should use the code as the id", function () {
const details = new HostPairingDetails("ABC-DEF", "New Host", "10.0.0.1");
assert.equal(details.id, "ABC-DEF");
});
});
describe(".toJSON()", function () {
it("should only include required fields when optional fields are defaults", function () {
const details = new HostPairingDetails("ABC-DEF", "New Host", "10.0.0.1", "", 0, 0, false);
assert.deepEqual(details.toJSON(), {
code: "ABC-DEF",
name: "New Host",
remoteAddress: "10.0.0.1",
});
});
it("should include all optional fields when set", function () {
const details = new HostPairingDetails("ABC-DEF", "New Host", "10.0.0.1", "2.0.0", 100, 200, true);
assert.deepEqual(details.toJSON(), {
code: "ABC-DEF",
name: "New Host",
remoteAddress: "10.0.0.1",
version: "2.0.0",
createdAtMs: 100,
updatedAtMs: 200,
isDeleted: true,
});
});
it("should not include the id getter", function () {
const details = new HostPairingDetails("ABC-DEF", "New Host", "10.0.0.1");
assert.equal(Object.hasOwn(JSON.parse(JSON.stringify(details)), "id"), false);
});
});
describe("static fromJSON()", function () {
it("should construct minimal object", function () {
const details = HostPairingDetails.fromJSON({
code: "ABC-DEF",
name: "New Host",
remoteAddress: "10.0.0.1",
});
assert.equal(details.code, "ABC-DEF");
assert.equal(details.version, "");
assert.equal(details.createdAtMs, 0);
assert.equal(details.updatedAtMs, 0);
assert.equal(details.isDeleted, false);
});
});
});