惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
美团技术团队
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
A
About on SuperTechFans
Recent Announcements
Recent Announcements
D
Docker
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
腾讯CDC
Martin Fowler
Martin Fowler
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test(slack,line): reduce hot extension test imports · ope...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -12,10 +12,92 @@ const resolvePluginConversationBindingApprovalMock = vi.hoisted(() => vi.fn());

1212

const buildPluginBindingResolvedTextMock = vi.hoisted(() => vi.fn(() => "Binding updated."));

13131414

let registerSlackInteractionEvents: typeof import("./interactions.js").registerSlackInteractionEvents;

15-

let enqueueSystemEventSpy: ReturnType<typeof vi.spyOn>;

16-

let dispatchPluginInteractiveHandlerSpy: ReturnType<typeof vi.spyOn>;

17-

let resolvePluginConversationBindingApprovalSpy: ReturnType<typeof vi.spyOn>;

18-

let buildPluginBindingResolvedTextSpy: ReturnType<typeof vi.spyOn>;

15+16+

vi.mock("openclaw/plugin-sdk/infra-runtime", () => ({

17+

enqueueSystemEvent: (...args: unknown[]) => enqueueSystemEventMock(...args),

18+

}));

19+20+

vi.mock("../../interactive-dispatch.js", () => ({

21+

dispatchSlackPluginInteractiveHandler: (params: {

22+

data: string;

23+

interactionId: string;

24+

ctx: {

25+

interaction?: Record<string, unknown>;

26+

} & Record<string, unknown>;

27+

respond: unknown;

28+

}) =>

29+

(dispatchPluginInteractiveHandlerMock as (arg: unknown) => Promise<unknown>)({

30+

channel: "slack",

31+

data: params.data,

32+

dedupeId: params.interactionId,

33+

invoke: async ({

34+

registration,

35+

namespace,

36+

payload,

37+

}: {

38+

registration: { handler: (ctx: unknown) => unknown };

39+

namespace: string;

40+

payload: string;

41+

}) =>

42+

registration.handler({

43+

...params.ctx,

44+

channel: "slack",

45+

interaction: {

46+

...params.ctx.interaction,

47+

data: params.data,

48+

namespace,

49+

payload,

50+

},

51+

respond: params.respond,

52+

requestConversationBinding: vi.fn(),

53+

detachConversationBinding: vi.fn(),

54+

getCurrentConversationBinding: vi.fn(),

55+

}),

56+

}),

57+

}));

58+59+

vi.mock("../conversation.runtime.js", () => {

60+

const parsePluginBindingApprovalCustomId = (value: string) => {

61+

const prefix = "pluginbind:";

62+

const trimmed = value.trim();

63+

if (!trimmed.startsWith(prefix)) {

64+

return null;

65+

}

66+

const body = trimmed.slice(prefix.length);

67+

const separator = body.lastIndexOf(":");

68+

if (separator <= 0 || separator === body.length - 1) {

69+

return null;

70+

}

71+

const decisionCode = body.slice(separator + 1).trim();

72+

const decision =

73+

decisionCode === "o"

74+

? "allow-once"

75+

: decisionCode === "a"

76+

? "allow-always"

77+

: decisionCode === "d"

78+

? "deny"

79+

: null;

80+

if (!decision) {

81+

return null;

82+

}

83+

return {

84+

approvalId: decodeURIComponent(body.slice(0, separator).trim()),

85+

decision,

86+

};

87+

};

88+89+

return {

90+

buildPluginBindingResolvedText: (...args: unknown[]) =>

91+

(buildPluginBindingResolvedTextMock as (...innerArgs: unknown[]) => string)(...args),

92+

parsePluginBindingApprovalCustomId,

93+

resolvePluginConversationBindingApproval: (...args: unknown[]) =>

94+

(

95+

resolvePluginConversationBindingApprovalMock as (

96+

...innerArgs: unknown[]

97+

) => Promise<unknown>

98+

)(...args),

99+

};

100+

});

1910120102

type RegisteredHandler = (args: {

21103

ack: () => Promise<void>;

@@ -167,49 +249,10 @@ function createContext(overrides?: {

167249168250

describe("registerSlackInteractionEvents", () => {

169251

beforeAll(async () => {

170-

const channelRuntime = await import("openclaw/plugin-sdk/infra-runtime");

171-

const pluginRuntime = await import("openclaw/plugin-sdk/plugin-runtime");

172-

const conversationBinding = await import("../../../../../src/plugins/conversation-binding.js");

173-

enqueueSystemEventSpy = vi

174-

.spyOn(channelRuntime, "enqueueSystemEvent")

175-

.mockImplementation(((...args: Parameters<typeof channelRuntime.enqueueSystemEvent>) =>

176-

(enqueueSystemEventMock as (...innerArgs: unknown[]) => boolean)(

177-

...args,

178-

)) as typeof channelRuntime.enqueueSystemEvent);

179-

dispatchPluginInteractiveHandlerSpy = vi

180-

.spyOn(pluginRuntime, "dispatchPluginInteractiveHandler")

181-

.mockImplementation(((

182-

...args: Parameters<typeof pluginRuntime.dispatchPluginInteractiveHandler>

183-

) =>

184-

(dispatchPluginInteractiveHandlerMock as (...innerArgs: unknown[]) => Promise<unknown>)(

185-

...args,

186-

)) as typeof pluginRuntime.dispatchPluginInteractiveHandler);

187-

resolvePluginConversationBindingApprovalSpy = vi

188-

.spyOn(conversationBinding, "resolvePluginConversationBindingApproval")

189-

.mockImplementation(((

190-

...args: Parameters<typeof conversationBinding.resolvePluginConversationBindingApproval>

191-

) =>

192-

(

193-

resolvePluginConversationBindingApprovalMock as (

194-

...innerArgs: unknown[]

195-

) => Promise<unknown>

196-

)(...args)) as typeof conversationBinding.resolvePluginConversationBindingApproval);

197-

buildPluginBindingResolvedTextSpy = vi

198-

.spyOn(conversationBinding, "buildPluginBindingResolvedText")

199-

.mockImplementation(((

200-

...args: Parameters<typeof conversationBinding.buildPluginBindingResolvedText>

201-

) =>

202-

(buildPluginBindingResolvedTextMock as (...innerArgs: unknown[]) => string)(

203-

...args,

204-

)) as typeof conversationBinding.buildPluginBindingResolvedText);

205252

({ registerSlackInteractionEvents } = await import("./interactions.js"));

206253

});

207254208255

beforeEach(() => {

209-

enqueueSystemEventSpy.mockClear();

210-

dispatchPluginInteractiveHandlerSpy.mockClear();

211-

resolvePluginConversationBindingApprovalSpy.mockClear();

212-

buildPluginBindingResolvedTextSpy.mockClear();

213256

enqueueSystemEventMock.mockClear();

214257

dispatchPluginInteractiveHandlerMock.mockClear();

215258

resolvePluginConversationBindingApprovalMock.mockClear();