First Release of Claw3D (#11)

Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
Luke The Dev
2026-03-19 23:14:04 -05:00
committed by GitHub
parent 5ea96b2650
commit 4fa4f13558
431 changed files with 105438 additions and 14 deletions
+47
View File
@@ -0,0 +1,47 @@
// @vitest-environment node
import { describe, expect, it, vi } from "vitest";
import { spawnSync } from "node:child_process";
vi.mock("node:child_process", async () => {
const actual = await vi.importActual<typeof import("node:child_process")>(
"node:child_process"
);
return {
default: actual,
...actual,
spawnSync: vi.fn(),
};
});
import { runSshJson } from "@/lib/ssh/gateway-host";
const mockedSpawnSync = vi.mocked(spawnSync);
describe("runSshJson", () => {
it("forwards maxBuffer to spawnSync when provided", () => {
mockedSpawnSync.mockReturnValueOnce({
status: 0,
stdout: JSON.stringify({ ok: true }),
stderr: "",
error: undefined,
} as never);
runSshJson({
sshTarget: "me@example.test",
argv: ["bash", "-lc", "echo ok"],
label: "ssh-json-test",
input: "echo hello",
maxBuffer: 12345,
} as unknown as Parameters<typeof runSshJson>[0]);
expect(mockedSpawnSync).toHaveBeenCalledTimes(1);
const [, , options] = mockedSpawnSync.mock.calls[0] as [
string,
string[],
{ encoding?: string; input?: string; maxBuffer?: number },
];
expect(options.maxBuffer).toBe(12345);
});
});