mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 01:04:42 +00:00
Stabilize SDK mode integration test
This commit is contained in:
parent
24e99ac5e7
commit
ec8b6afea9
274 changed files with 5412 additions and 7893 deletions
|
|
@ -25,7 +25,7 @@ export function prepareMockAgentDataHome(dataHome: string): Record<string, strin
|
|||
runtimeEnv.XDG_DATA_HOME = dataHome;
|
||||
}
|
||||
|
||||
const nodeScript = String.raw`#!/usr/bin/env node
|
||||
const nodeScript = String.raw`#!/usr/bin/env node
|
||||
const { createInterface } = require("node:readline");
|
||||
|
||||
let nextSession = 0;
|
||||
|
|
@ -225,13 +225,9 @@ rl.on("line", (line) => {
|
|||
const processDir = join(installDir, "agent_processes");
|
||||
mkdirSync(processDir, { recursive: true });
|
||||
|
||||
const runner = process.platform === "win32"
|
||||
? join(processDir, "mock-acp.cmd")
|
||||
: join(processDir, "mock-acp");
|
||||
const runner = process.platform === "win32" ? join(processDir, "mock-acp.cmd") : join(processDir, "mock-acp");
|
||||
|
||||
const scriptFile = process.platform === "win32"
|
||||
? join(processDir, "mock-acp.js")
|
||||
: runner;
|
||||
const scriptFile = process.platform === "win32" ? join(processDir, "mock-acp.js") : runner;
|
||||
|
||||
writeFileSync(scriptFile, nodeScript);
|
||||
|
||||
|
|
|
|||
|
|
@ -538,9 +538,17 @@ describe("Integration: TypeScript SDK flat session API", () => {
|
|||
const session = await sdk.createSession({ agent: "mock" });
|
||||
await session.setMode("plan");
|
||||
|
||||
const modes = await session.getModes();
|
||||
expect(modes?.currentModeId).toBe("plan");
|
||||
expect((await session.getConfigOptions()).find((o) => o.category === "mode")?.currentValue).toBe("plan");
|
||||
const modes = await waitForAsync(async () => {
|
||||
const current = await session.getModes();
|
||||
return current?.currentModeId === "plan" ? current : null;
|
||||
});
|
||||
expect(modes.currentModeId).toBe("plan");
|
||||
|
||||
const modeOption = await waitForAsync(async () => {
|
||||
const option = (await session.getConfigOptions()).find((o) => o.category === "mode");
|
||||
return option?.currentValue === "plan" ? option : null;
|
||||
});
|
||||
expect(modeOption.currentValue).toBe("plan");
|
||||
|
||||
await sdk.dispose();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue