mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Add ability to define plugin code that runs in the context of a host, starts up with the host does, and stops when the host shuts down.
23 lines
716 B
JavaScript
23 lines
716 B
JavaScript
"use strict";
|
|
const assert = require("assert").strict;
|
|
const mock = require("../mock");
|
|
|
|
const host = require("@clusterio/host");
|
|
|
|
describe("host/src/BaseHostPlugin", function() {
|
|
describe("class BaseHostPlugin", function() {
|
|
let hostPlugin;
|
|
it("should be constructible", async function() {
|
|
hostPlugin = new host.BaseHostPlugin({}, new mock.MockHost(), new mock.MockLogger());
|
|
await hostPlugin.init();
|
|
});
|
|
it("should define defaults for hooks", async function() {
|
|
await hostPlugin.onHostConfigFieldChanged();
|
|
await hostPlugin.onMetrics();
|
|
await hostPlugin.onShutdown();
|
|
hostPlugin.onControllerConnectionEvent("connect");
|
|
await hostPlugin.onPrepareControllerDisconnect();
|
|
});
|
|
});
|
|
});
|