mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
34 lines
977 B
JavaScript
34 lines
977 B
JavaScript
"use strict";
|
|
const assert = require("assert").strict;
|
|
const lib = require("@clusterio/lib");
|
|
|
|
const { Host } = require("@clusterio/host");
|
|
|
|
describe("messages/host", function() {
|
|
/** @type {Host} */
|
|
let host;
|
|
|
|
beforeEach(function() {
|
|
const hostConfig = new lib.HostConfig("host");
|
|
const hostConnector = new lib.VirtualConnector(
|
|
lib.Address.fromShorthand({ hostId: 1 }),
|
|
lib.Address.fromShorthand("controller"),
|
|
);
|
|
host = new Host(hostConnector, hostConfig, undefined, []);
|
|
});
|
|
|
|
describe("HostUpdateRequest", function() {
|
|
it("runs", async function() {
|
|
host.config.set("host.allow_remote_updates", true);
|
|
await host.handleHostUpdateRequest(new lib.HostUpdateRequest());
|
|
});
|
|
it("rejects if updates are disabled", async function() {
|
|
host.config.set("host.allow_remote_updates", false);
|
|
await assert.rejects(
|
|
host.handleHostUpdateRequest(new lib.HostUpdateRequest()),
|
|
/Remote updates are disabled on this machine/
|
|
);
|
|
});
|
|
});
|
|
});
|