mirror of
https://github.com/morluto/rea
synced 2026-10-28 06:46:47 -04:00
118d43e787
* perf(setup): reuse initial diagnostics during planning * test(setup): verify post-configuration doctor refresh * style(setup): remove extra test spacing
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import { runSetup } from "./Setup.js";
|
|
import { FakeSetupHost, options } from "./Setup.fixture.js";
|
|
|
|
it("uses the shared initial host snapshot for setup planning", async () => {
|
|
const host = new FakeSetupHost();
|
|
host.hopperPath = () => {
|
|
throw new Error("setup snapshot should provide the Hopper path");
|
|
};
|
|
host.providerEnvironment = () => {
|
|
throw new Error("setup snapshot should provide provider settings");
|
|
};
|
|
host.initialSetupState = async (scope) => ({
|
|
hopperPath: "/snapshot/Hopper",
|
|
providerEnvironment: { HOPPER_LAUNCHER_PATH: "/snapshot/Hopper" },
|
|
doctor: await host.doctor(scope),
|
|
});
|
|
host.clients = [{ name: "codex", configPath: "/codex.json" }];
|
|
|
|
const result = await runSetup(
|
|
{ ...options(false), dryRun: true, clientIds: ["codex"] },
|
|
host,
|
|
);
|
|
|
|
expect(result.status).toBe("planned");
|
|
expect(result.plannedActions.map(({ id }) => id)).toContain(
|
|
"configure_client:codex",
|
|
);
|
|
expect(host.doctorCalls).toBe(1);
|
|
});
|
|
|
|
it("refreshes doctor after approved setup changes", async () => {
|
|
const host = new FakeSetupHost();
|
|
host.doctorHealthy = false;
|
|
host.skill = "unchanged";
|
|
host.clients = [{ name: "codex", configPath: "/codex.json" }];
|
|
const configureClient = host.configureClient;
|
|
host.configureClient = (client, providerEnvironment, command) => {
|
|
host.doctorHealthy = true;
|
|
return configureClient(client, providerEnvironment, command);
|
|
};
|
|
|
|
const result = await runSetup(
|
|
{ ...options(true), clientIds: ["codex"], installSkill: false },
|
|
host,
|
|
);
|
|
|
|
expect(result.doctor.healthy).toBe(true);
|
|
expect(host.doctorCalls).toBe(2);
|
|
});
|