mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 02:50:42 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { discordApprovalNativeRuntime } from "./approval-handler.runtime.js";
|
|
|
|
describe("discordApprovalNativeRuntime", () => {
|
|
it("routes origin approval updates to the Discord thread channel when threadId is present", async () => {
|
|
const prepared = await discordApprovalNativeRuntime.transport.prepareTarget({
|
|
cfg: {} as never,
|
|
accountId: "main",
|
|
context: {
|
|
token: "discord-token",
|
|
config: {} as never,
|
|
},
|
|
plannedTarget: {
|
|
surface: "origin",
|
|
reason: "preferred",
|
|
target: {
|
|
to: "123456789",
|
|
threadId: "777888999",
|
|
},
|
|
},
|
|
request: {
|
|
id: "req-1",
|
|
request: {
|
|
command: "hostname",
|
|
},
|
|
createdAtMs: 0,
|
|
expiresAtMs: 1_000,
|
|
},
|
|
approvalKind: "exec",
|
|
view: {} as never,
|
|
pendingPayload: {} as never,
|
|
});
|
|
|
|
expect(prepared).toEqual({
|
|
dedupeKey: "777888999",
|
|
target: {
|
|
discordChannelId: "777888999",
|
|
},
|
|
});
|
|
});
|
|
});
|