mirror of
https://github.com/morluto/rea
synced 2026-10-26 06:16:17 -04:00
test(hopper): fix fixture context and cleanup assumptions
This commit is contained in:
@@ -306,7 +306,7 @@ test.for(["handoff", "not-found"] as const)(
|
||||
const token = setting("REA_TOKEN");
|
||||
const runId = setting("REA_RUN_ID");
|
||||
runtime = dirname(socket);
|
||||
const lateBridge = async (identity: string, credential = token) => {
|
||||
const lateBridge = (identity: string, credential = token) => {
|
||||
const child = spawn(
|
||||
process.execPath,
|
||||
[
|
||||
@@ -318,14 +318,14 @@ test.for(["handoff", "not-found"] as const)(
|
||||
{ stdio: "ignore" },
|
||||
);
|
||||
children.push(child);
|
||||
await vi.waitFor(() => access(socket));
|
||||
return child;
|
||||
};
|
||||
for (const [identity, credential] of [
|
||||
["different-run", token],
|
||||
[runId, "different-token"],
|
||||
] as const) {
|
||||
const wrong = await lateBridge(identity, credential);
|
||||
const wrong = lateBridge(identity, credential);
|
||||
await vi.waitFor(() => access(socket));
|
||||
expect(parseMcpToolError(await call("close_binary")).error.code).toBe(
|
||||
"cleanup_incomplete",
|
||||
);
|
||||
@@ -336,7 +336,9 @@ test.for(["handoff", "not-found"] as const)(
|
||||
}
|
||||
const closing = call("close_binary");
|
||||
await delay(150);
|
||||
const owned = await lateBridge(runId);
|
||||
// A verified close may remove the socket before the fixture can poll it.
|
||||
// The successful close and child exit establish the owned bridge outcome.
|
||||
const owned = lateBridge(runId);
|
||||
expect((await closing).isError).not.toBe(true);
|
||||
await vi.waitFor(() => expect(owned.exitCode).toBe(0));
|
||||
await expect(access(runtime)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
|
||||
Reference in New Issue
Block a user