mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 21:28:26 +00:00
test(gateway): consolidate server suites for speed
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { getFreePort, installGatewayTestHooks, startGatewayServer } from "./test-helpers.js";
|
||||
import {
|
||||
connectOk,
|
||||
getFreePort,
|
||||
installGatewayTestHooks,
|
||||
rpcReq,
|
||||
startGatewayServer,
|
||||
startServerWithClient,
|
||||
} from "./test-helpers.js";
|
||||
|
||||
const hoisted = vi.hoisted(() => {
|
||||
const cronInstances: Array<{
|
||||
@@ -158,7 +165,7 @@ vi.mock("./config-reload.js", () => ({
|
||||
startGatewayConfigReloader: hoisted.startGatewayConfigReloader,
|
||||
}));
|
||||
|
||||
installGatewayTestHooks();
|
||||
installGatewayTestHooks({ scope: "suite" });
|
||||
|
||||
describe("gateway hot reload", () => {
|
||||
let prevSkipChannels: string | undefined;
|
||||
@@ -298,3 +305,15 @@ describe("gateway hot reload", () => {
|
||||
await server.close();
|
||||
});
|
||||
});
|
||||
|
||||
describe("gateway agents", () => {
|
||||
it("lists configured agents via agents.list RPC", async () => {
|
||||
const { server, ws } = await startServerWithClient();
|
||||
await connectOk(ws);
|
||||
const res = await rpcReq<{ agents: Array<{ id: string }> }>(ws, "agents.list", {});
|
||||
expect(res.ok).toBe(true);
|
||||
expect(res.payload?.agents.map((agent) => agent.id)).toContain("main");
|
||||
ws.close();
|
||||
await server.close();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user