





















@@ -26,6 +26,15 @@ describe("resolveRequesterOriginForChild", () => {
2626})?.accountId;
2727}
282829+function expectOrigin(
30+origin: ReturnType<typeof resolveRequesterOriginForChild>,
31+expected: { channel: string; accountId: string; to: string },
32+) {
33+expect(origin?.channel).toBe(expected.channel);
34+expect(origin?.accountId).toBe(expected.accountId);
35+expect(origin?.to).toBe(expected.to);
36+}
37+2938it.each([
3039["channel:conversation-a", "channel:conversation-a", "channel"],
3140["dm:conversation-a", "dm:conversation-a", "direct"],
@@ -46,7 +55,7 @@ describe("resolveRequesterOriginForChild", () => {
4655],
4756} as OpenClawConfig;
485749-expect(
58+expectOrigin(
5059resolveRequesterOriginForChild({
5160 cfg,
5261targetAgentId: "bot-alpha",
@@ -55,11 +64,12 @@ describe("resolveRequesterOriginForChild", () => {
5564requesterAccountId: "bot-beta",
5665requesterTo: to,
5766}),
58-).toMatchObject({
59-channel: "qa-channel",
60-accountId: "bot-alpha-qa",
61- to,
62-});
67+{
68+channel: "qa-channel",
69+accountId: "bot-alpha-qa",
70+ to,
71+},
72+);
6373},
6474);
6575@@ -213,7 +223,7 @@ describe("resolveRequesterOriginForChild", () => {
213223],
214224} as OpenClawConfig;
215225216-expect(
226+expectOrigin(
217227resolveRequesterOriginForChild({
218228 cfg,
219229targetAgentId: "bot-alpha",
@@ -222,11 +232,12 @@ describe("resolveRequesterOriginForChild", () => {
222232requesterAccountId: "bot-beta",
223233requesterTo: to,
224234}),
225-).toMatchObject({
226-channel: "msteams",
227-accountId: "bot-alpha-teams",
228- to,
229-});
235+{
236+channel: "msteams",
237+accountId: "bot-alpha-teams",
238+ to,
239+},
240+);
230241});
231242232243it("keeps explicit channel prefixes ahead of ids that start with direct marker characters", () => {
@@ -244,7 +255,7 @@ describe("resolveRequesterOriginForChild", () => {
244255],
245256} as OpenClawConfig;
246257247-expect(
258+expectOrigin(
248259resolveRequesterOriginForChild({
249260 cfg,
250261targetAgentId: "bot-alpha",
@@ -253,11 +264,12 @@ describe("resolveRequesterOriginForChild", () => {
253264requesterAccountId: "bot-beta",
254265requesterTo: to,
255266}),
256-).toMatchObject({
257-channel: "qa-channel",
258-accountId: "bot-alpha-qa",
259- to,
260-});
267+{
268+channel: "qa-channel",
269+accountId: "bot-alpha-qa",
270+ to,
271+},
272+);
261273});
262274263275it("uses requester group space before selecting a scoped target-agent account", () => {
@@ -285,7 +297,7 @@ describe("resolveRequesterOriginForChild", () => {
285297],
286298} as OpenClawConfig;
287299288-expect(
300+expectOrigin(
289301resolveRequesterOriginForChild({
290302 cfg,
291303targetAgentId: "bot-alpha",
@@ -295,11 +307,12 @@ describe("resolveRequesterOriginForChild", () => {
295307requesterTo: to,
296308requesterGroupSpace: "guild-current",
297309}),
298-).toMatchObject({
299-channel: "discord",
300-accountId: "bot-alpha-current-guild",
301- to,
302-});
310+{
311+channel: "discord",
312+accountId: "bot-alpha-current-guild",
313+ to,
314+},
315+);
303316});
304317305318it("still peels channel id plus kind wrappers before peer lookup", () => {
@@ -317,7 +330,7 @@ describe("resolveRequesterOriginForChild", () => {
317330],
318331} as OpenClawConfig;
319332320-expect(
333+expectOrigin(
321334resolveRequesterOriginForChild({
322335 cfg,
323336targetAgentId: "bot-alpha",
@@ -326,10 +339,11 @@ describe("resolveRequesterOriginForChild", () => {
326339requesterAccountId: "bot-beta",
327340requesterTo: to,
328341}),
329-).toMatchObject({
330-channel: "line",
331-accountId: "bot-alpha-line",
332- to,
333-});
342+{
343+channel: "line",
344+accountId: "bot-alpha-line",
345+ to,
346+},
347+);
334348});
335349});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。