mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 08:20:43 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import { resolveRequesterOriginForChild } from "./spawn-requester-origin.js";
|
|
|
|
describe("resolveRequesterOriginForChild", () => {
|
|
it.each([
|
|
["channel:conversation-a", "channel:conversation-a"],
|
|
["thread:conversation-a/thread-a", "thread:conversation-a/thread-a"],
|
|
])("keeps canonical prefixed peer id %s eligible for exact binding lookup", (to, peerId) => {
|
|
const cfg = {
|
|
bindings: [
|
|
{
|
|
type: "route",
|
|
agentId: "bot-alpha",
|
|
match: {
|
|
channel: "qa-channel",
|
|
peer: {
|
|
kind: "channel",
|
|
id: peerId,
|
|
},
|
|
accountId: "bot-alpha-qa",
|
|
},
|
|
},
|
|
],
|
|
} as OpenClawConfig;
|
|
|
|
expect(
|
|
resolveRequesterOriginForChild({
|
|
cfg,
|
|
targetAgentId: "bot-alpha",
|
|
requesterAgentId: "main",
|
|
requesterChannel: "qa-channel",
|
|
requesterAccountId: "bot-beta",
|
|
requesterTo: to,
|
|
}),
|
|
).toMatchObject({
|
|
channel: "qa-channel",
|
|
accountId: "bot-alpha-qa",
|
|
to,
|
|
});
|
|
});
|
|
});
|