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({
approvals: createAllowlistOnMissApprovals(),
run: async () => {
const tempDir = createFixtureDir("openclaw-inline-eval-bin-");
for (const testCase of cases) {
const tempDir = createFixtureDir("openclaw-inline-eval-bin-");
try {
const executablePath = createTempExecutable({
dir: tempDir,
name: testCase.executable,
});
const { runCommand, sendInvokeResult } = await runSystemInvoke({
preferMacAppExecHost: false,
command: [executablePath, ...testCase.args],
security: "allowlist",
ask: "on-miss",
approvalDecision: "allow-always",
approved: true,
runCommand: vi.fn(async () => createLocalRunResult("inline-eval-ok")),
});
const executablePath = createTempExecutable({
dir: tempDir,
name: testCase.executable,
});
const { runCommand, sendInvokeResult } = await runSystemInvoke({
preferMacAppExecHost: false,
command: [executablePath, ...testCase.args],
security: "allowlist",
ask: "on-miss",
approvalDecision: "allow-always",
approved: true,
runCommand: vi.fn(async () => createLocalRunResult("inline-eval-ok")),
});
expect(runCommand).toHaveBeenCalledTimes(1);
expectInvokeOk(sendInvokeResult, { payloadContains: "inline-eval-ok" });
expect(loadExecApprovals().agents?.main?.allowlist ?? []).toEqual([]);
} finally {
fs.rmSync(tempDir, { recursive: true, force: true });
}
expect(runCommand).toHaveBeenCalledTimes(1);
expectInvokeOk(sendInvokeResult, { payloadContains: "inline-eval-ok" });
expect(loadExecApprovals().agents?.main?.allowlist ?? []).toEqual([]);
}
},
});