test: reuse inline eval fixtures

This commit is contained in:
Peter Steinberger
2026-04-17 19:25:58 +01:00
parent e75cd46ba6
commit 7edce9c8fa

View File

@@ -1430,29 +1430,25 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
await withTempApprovalsHome({ await withTempApprovalsHome({
approvals: createAllowlistOnMissApprovals(), approvals: createAllowlistOnMissApprovals(),
run: async () => { run: async () => {
const tempDir = createFixtureDir("openclaw-inline-eval-bin-");
for (const testCase of cases) { for (const testCase of cases) {
const tempDir = createFixtureDir("openclaw-inline-eval-bin-"); const executablePath = createTempExecutable({
try { dir: tempDir,
const executablePath = createTempExecutable({ name: testCase.executable,
dir: tempDir, });
name: testCase.executable, const { runCommand, sendInvokeResult } = await runSystemInvoke({
}); preferMacAppExecHost: false,
const { runCommand, sendInvokeResult } = await runSystemInvoke({ command: [executablePath, ...testCase.args],
preferMacAppExecHost: false, security: "allowlist",
command: [executablePath, ...testCase.args], ask: "on-miss",
security: "allowlist", approvalDecision: "allow-always",
ask: "on-miss", approved: true,
approvalDecision: "allow-always", runCommand: vi.fn(async () => createLocalRunResult("inline-eval-ok")),
approved: true, });
runCommand: vi.fn(async () => createLocalRunResult("inline-eval-ok")),
});
expect(runCommand).toHaveBeenCalledTimes(1); expect(runCommand).toHaveBeenCalledTimes(1);
expectInvokeOk(sendInvokeResult, { payloadContains: "inline-eval-ok" }); expectInvokeOk(sendInvokeResult, { payloadContains: "inline-eval-ok" });
expect(loadExecApprovals().agents?.main?.allowlist ?? []).toEqual([]); expect(loadExecApprovals().agents?.main?.allowlist ?? []).toEqual([]);
} finally {
fs.rmSync(tempDir, { recursive: true, force: true });
}
} }
}, },
}); });