mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-23 04:41:14 +00:00
fix(docker): keep gateway ws client self-contained (#107561)
* fix(docker): keep gateway ws client self-contained * test(raft): narrow optional runtime schema * test(tlon): narrow signed URL mock input * fix(tui): type searchable selector metadata
This commit is contained in:
committed by
GitHub
parent
3b9c0efadd
commit
242cdca058
@@ -3,7 +3,7 @@ import { createServer, type Server } from "node:http";
|
||||
import type { Duplex } from "node:stream";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { WebSocket, WebSocketServer } from "ws";
|
||||
import { createGatewayWsClient } from "../../scripts/dev/gateway-ws-client.js";
|
||||
import { createGatewayWsClient, rawDataToString } from "../../scripts/dev/gateway-ws-client.js";
|
||||
|
||||
let server: Server | undefined;
|
||||
let wss: WebSocketServer | undefined;
|
||||
@@ -88,6 +88,14 @@ async function listenStalledUpgrade(): Promise<{ close: () => Promise<void>; url
|
||||
}
|
||||
|
||||
describe("createGatewayWsClient", () => {
|
||||
it("decodes every ws raw-data shape without core source files", () => {
|
||||
expect(rawDataToString(Buffer.from("buffer"))).toBe("buffer");
|
||||
expect(rawDataToString(Uint8Array.from(Buffer.from("array-buffer")).buffer)).toBe(
|
||||
"array-buffer",
|
||||
);
|
||||
expect(rawDataToString([Buffer.from("frag"), Buffer.from("ments")])).toBe("fragments");
|
||||
});
|
||||
|
||||
it("rejects pending RPC requests when the client closes", async () => {
|
||||
const url = await listen(() => {});
|
||||
const client = createGatewayWsClient({ url });
|
||||
|
||||
Reference in New Issue
Block a user