mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:00:43 +00:00
test: reuse inline eval fixtures
This commit is contained in:
@@ -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([]);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user