Stream live server logs over SSE
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { scumAnnouncementCommand, scumManagementRCONCommandRequest } from "./scumManagementRcon";
|
||||
|
||||
describe("SCUM management RCON bridge schema", () => {
|
||||
it("builds a protected bridge request without connection material", () => {
|
||||
const stamp = Date.UTC(2026, 7, 3, 8, 0, 0);
|
||||
|
||||
expect(scumManagementRCONCommandRequest("server/unsafe", " ListPlayers ", stamp)).toEqual({
|
||||
profileKey: "scum-client-manager",
|
||||
commandType: "management.rcon.request",
|
||||
payload: { requestText: "#ListPlayers" },
|
||||
idempotencyKey: `web:scum-rcon:server-unsafe:${stamp}`,
|
||||
priority: 20,
|
||||
expiresAt: "2026-08-03T08:02:00.000Z"
|
||||
});
|
||||
});
|
||||
|
||||
it("formats announcements and rejects framed command text", () => {
|
||||
expect(scumAnnouncementCommand("Restart in ten minutes")).toBe("#Announce Restart in ten minutes");
|
||||
expect(scumManagementRCONCommandRequest("server-1", "#SetTime 12").payload).toEqual({ requestText: "#SetTime 12" });
|
||||
expect(() => scumManagementRCONCommandRequest("server-1", "ListPlayers\nSetTime 12")).toThrow("管理指令必须是受限的单行文本");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user