mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
test: avoid real waits in cdp and outbound tests
This commit is contained in:
@@ -963,6 +963,22 @@ describe("cdp internal", () => {
|
||||
const msg = JSON.parse(rawDataToString(raw)) as { id?: number; method?: string };
|
||||
if (msg.method === "Target.createTarget") {
|
||||
socket.send(JSON.stringify({ id: msg.id, result: { targetId: "T_BARE_WS" } }));
|
||||
return;
|
||||
}
|
||||
if (msg.method === "Target.attachToTarget") {
|
||||
socket.send(JSON.stringify({ id: msg.id, result: { sessionId: "S_BARE_WS" } }));
|
||||
return;
|
||||
}
|
||||
if (
|
||||
msg.method === "Page.enable" ||
|
||||
msg.method === "Runtime.enable" ||
|
||||
msg.method === "Network.enable" ||
|
||||
msg.method === "DOM.enable" ||
|
||||
msg.method === "Accessibility.enable" ||
|
||||
msg.method === "Runtime.runIfWaitingForDebugger" ||
|
||||
msg.method === "Target.detachFromTarget"
|
||||
) {
|
||||
socket.send(JSON.stringify({ id: msg.id, result: {} }));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,7 +125,28 @@ describe("runMessageAction core send routing", () => {
|
||||
});
|
||||
|
||||
it("accepts Telegram numeric forum topic targets through plugin-owned grammar", async () => {
|
||||
setActivePluginRegistry(createTestRegistry([]));
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([
|
||||
{
|
||||
pluginId: "telegram",
|
||||
source: "test",
|
||||
plugin: createOutboundTestPlugin({
|
||||
id: "telegram",
|
||||
outbound: {
|
||||
deliveryMode: "direct",
|
||||
sendText: vi.fn(),
|
||||
},
|
||||
messaging: {
|
||||
normalizeTarget: (raw) =>
|
||||
raw === "-1001234567890:topic:42" ? "telegram:-1001234567890:topic:42" : undefined,
|
||||
targetResolver: {
|
||||
looksLikeId: (raw) => raw === "-1001234567890:topic:42",
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
]),
|
||||
);
|
||||
|
||||
const result = await runMessageAction({
|
||||
cfg: {
|
||||
|
||||
Reference in New Issue
Block a user