mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 02:01:16 +00:00
Merged via squash.
Prepared head SHA: b7c20a7398
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { matrixApprovalNativeRuntime } from "./approval-handler.runtime.js";
|
|
|
|
describe("matrixApprovalNativeRuntime", () => {
|
|
it("uses a longer code fence when resolved commands contain triple backticks", async () => {
|
|
const result = await matrixApprovalNativeRuntime.presentation.buildResolvedResult({
|
|
cfg: {} as never,
|
|
accountId: "default",
|
|
context: {
|
|
client: {} as never,
|
|
},
|
|
request: {
|
|
id: "req-1",
|
|
request: {
|
|
command: "echo hi",
|
|
},
|
|
createdAtMs: 0,
|
|
expiresAtMs: 1_000,
|
|
},
|
|
resolved: {
|
|
id: "req-1",
|
|
decision: "allow-once",
|
|
ts: 0,
|
|
},
|
|
view: {
|
|
approvalKind: "exec",
|
|
approvalId: "req-1",
|
|
decision: "allow-once",
|
|
commandText: "echo ```danger```",
|
|
} as never,
|
|
entry: {} as never,
|
|
});
|
|
|
|
expect(result).toEqual({
|
|
kind: "update",
|
|
payload: [
|
|
"Exec approval: Allowed once",
|
|
"",
|
|
"Command",
|
|
"````",
|
|
"echo ```danger```",
|
|
"````",
|
|
].join("\n"),
|
|
});
|
|
});
|
|
});
|