mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 14:20:22 +00:00
test: speed up targeted unit suites
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { MessageEvent, PostbackEvent } from "@line/bot-sdk";
|
||||
import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { LineAccountConfig } from "./types.js";
|
||||
|
||||
// Avoid pulling in globals/pairing/media dependencies; this suite only asserts
|
||||
@@ -209,8 +209,12 @@ async function startInflightReplayDuplicate(params: {
|
||||
}
|
||||
|
||||
describe("handleLineWebhookEvents", () => {
|
||||
beforeEach(async () => {
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ handleLineWebhookEvents, createLineWebhookReplayCache } = await import("./bot-handlers.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
buildLineMessageContextMock.mockReset();
|
||||
buildLineMessageContextMock.mockImplementation(async () => ({
|
||||
ctxPayload: { From: "line:group:group-1" },
|
||||
@@ -225,7 +229,6 @@ describe("handleLineWebhookEvents", () => {
|
||||
readAllowFromStoreMock.mockImplementation(async () => [] as string[]);
|
||||
upsertPairingRequestMock.mockReset();
|
||||
upsertPairingRequestMock.mockImplementation(async () => ({ code: "CODE", created: true }));
|
||||
({ handleLineWebhookEvents, createLineWebhookReplayCache } = await import("./bot-handlers.js"));
|
||||
});
|
||||
it("blocks group messages when groupPolicy is disabled", async () => {
|
||||
const processMessage = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user