26 lines
924 B
TypeScript
26 lines
924 B
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { callProbeComputers, formatFailure, startBridge, startCraftos, waitForComputers } from "./harness.js";
|
|
|
|
test("probe-computers talks to the real TrapOS mcp-computer program", async () => {
|
|
const bridge = await startBridge();
|
|
const craftos = startCraftos("/programs/mcp-computer.lua", {
|
|
mountRepo: true,
|
|
shellArgs: [bridge.linkUrl],
|
|
timeoutMs: 15_000,
|
|
});
|
|
try {
|
|
await waitForComputers(bridge.registry, 1, 12_000);
|
|
const text = await callProbeComputers(bridge.mcpUrl);
|
|
assert.equal(text, "pong from 0 (Label: null)");
|
|
} catch (error) {
|
|
craftos.abort();
|
|
const result = await craftos.done;
|
|
throw new Error(formatFailure(error instanceof Error ? error.message : String(error), result.output), { cause: error });
|
|
} finally {
|
|
craftos.abort();
|
|
await craftos.done;
|
|
await bridge.close();
|
|
}
|
|
});
|