34 lines
813 B
JavaScript
34 lines
813 B
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { buildSshArgs } from "../src/services/serverLauncher.js";
|
|
|
|
test("builds ssh args with optional port and key file", () => {
|
|
assert.deepEqual(
|
|
buildSshArgs({
|
|
target: "user@192.0.2.10",
|
|
port: "2222",
|
|
keyFile: "/home/app/.ssh/game-key",
|
|
command: "bash /opt/game/start.sh",
|
|
}),
|
|
[
|
|
"-p",
|
|
"2222",
|
|
"-i",
|
|
"/home/app/.ssh/game-key",
|
|
"user@192.0.2.10",
|
|
"bash /opt/game/start.sh",
|
|
]
|
|
);
|
|
});
|
|
|
|
test("builds ssh args without optional port and key file", () => {
|
|
assert.deepEqual(
|
|
buildSshArgs({
|
|
target: "game-server",
|
|
port: "",
|
|
keyFile: "",
|
|
command: "bash /opt/game/start.sh",
|
|
}),
|
|
["game-server", "bash /opt/game/start.sh"]
|
|
);
|
|
});
|