mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:47:39 +00:00
fix: stabilize tests and logging
This commit is contained in:
@@ -3,6 +3,8 @@ import { ChannelType, MessageType } from "@buape/carbon";
|
||||
import { Routes } from "discord-api-types/v10";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { __resetDiscordChannelInfoCacheForTest } from "./monitor/message-utils.js";
|
||||
|
||||
const sendMock = vi.fn();
|
||||
const reactMock = vi.fn();
|
||||
const updateLastRouteMock = vi.fn();
|
||||
@@ -42,7 +44,7 @@ beforeEach(() => {
|
||||
});
|
||||
readAllowFromStoreMock.mockReset().mockResolvedValue([]);
|
||||
upsertPairingRequestMock.mockReset().mockResolvedValue({ code: "PAIRCODE", created: true });
|
||||
vi.resetModules();
|
||||
__resetDiscordChannelInfoCacheForTest();
|
||||
});
|
||||
|
||||
describe("discord tool result dispatch", () => {
|
||||
|
||||
@@ -44,6 +44,10 @@ const DISCORD_CHANNEL_INFO_CACHE = new Map<
|
||||
{ value: DiscordChannelInfo | null; expiresAt: number }
|
||||
>();
|
||||
|
||||
export function __resetDiscordChannelInfoCacheForTest() {
|
||||
DISCORD_CHANNEL_INFO_CACHE.clear();
|
||||
}
|
||||
|
||||
export async function resolveDiscordChannelInfo(
|
||||
client: Client,
|
||||
channelId: string,
|
||||
|
||||
Reference in New Issue
Block a user