mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:52:25 +00:00
test: speed up slack monitor suites
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { resetInboundDedupe } from "../../../src/auto-reply/reply/inbound-dedupe.js";
|
||||
import {
|
||||
flush,
|
||||
@@ -71,9 +71,11 @@ beforeEach(() => {
|
||||
resetInboundDedupe();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
({ monitorSlackProvider } = await import("./monitor.js"));
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
resetInboundDedupe();
|
||||
resetSlackTestState({
|
||||
messages: { responsePrefix: "PFX" },
|
||||
|
||||
@@ -26,7 +26,6 @@ describe("resolveSlackEffectiveAllowFrom", () => {
|
||||
const prevTtl = process.env.OPENCLAW_SLACK_PAIRING_ALLOWFROM_CACHE_TTL_MS;
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ clearSlackAllowFromCacheForTest, resolveSlackEffectiveAllowFrom } =
|
||||
await import("./auth.js"));
|
||||
});
|
||||
|
||||
@@ -118,7 +118,6 @@ async function createInFlightMessageScenario(ts: string) {
|
||||
|
||||
describe("createSlackMessageHandler app_mention race handling", () => {
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ createSlackMessageHandler } = await import("./message-handler.js"));
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { App } from "@slack/bolt";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../../../../../src/config/config.js";
|
||||
import type { SlackMessageEvent } from "../../types.js";
|
||||
|
||||
@@ -48,8 +48,7 @@ function buildChannelMessage(overrides?: Partial<SlackMessageEvent>): SlackMessa
|
||||
}
|
||||
|
||||
describe("thread-level session keys", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
await loadSlackPrepareModules();
|
||||
});
|
||||
|
||||
|
||||
@@ -185,7 +185,6 @@ let registerSlackMonitorSlashCommands: RegisterFn;
|
||||
const { dispatchMock } = getSlackSlashMocks();
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ registerSlackMonitorSlashCommands } = (await import("./slash.js")) as {
|
||||
registerSlackMonitorSlashCommands: RegisterFn;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user