mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:14:33 +00:00
perf(test): speed up line, models list, and memory batch
This commit is contained in:
@@ -1,6 +1,36 @@
|
||||
import type { MessageEvent } from "@line/bot-sdk";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
// Avoid pulling in globals/pairing/media dependencies; this suite only asserts
|
||||
// allowlist/groupPolicy gating and message-context wiring.
|
||||
vi.mock("../globals.js", () => ({
|
||||
danger: (text: string) => text,
|
||||
logVerbose: () => {},
|
||||
}));
|
||||
|
||||
vi.mock("../pairing/pairing-labels.js", () => ({
|
||||
resolvePairingIdLabel: () => "lineUserId",
|
||||
}));
|
||||
|
||||
vi.mock("../pairing/pairing-messages.js", () => ({
|
||||
buildPairingReply: () => "pairing-reply",
|
||||
}));
|
||||
|
||||
vi.mock("./download.js", () => ({
|
||||
downloadLineMedia: async () => {
|
||||
throw new Error("downloadLineMedia should not be called from bot-handlers tests");
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("./send.js", () => ({
|
||||
pushMessageLine: async () => {
|
||||
throw new Error("pushMessageLine should not be called from bot-handlers tests");
|
||||
},
|
||||
replyMessageLine: async () => {
|
||||
throw new Error("replyMessageLine should not be called from bot-handlers tests");
|
||||
},
|
||||
}));
|
||||
|
||||
const { buildLineMessageContextMock, buildLinePostbackContextMock } = vi.hoisted(() => ({
|
||||
buildLineMessageContextMock: vi.fn(async () => ({
|
||||
ctxPayload: { From: "line:group:group-1" },
|
||||
|
||||
Reference in New Issue
Block a user