mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:00:54 +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({
|
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 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user