mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:18:37 +00:00
test(telegram): use lightweight clears in media handler setup
This commit is contained in:
@@ -32,9 +32,9 @@ async function createBotHandlerWithOptions(options: {
|
|||||||
replySpy: ReturnType<typeof vi.fn>;
|
replySpy: ReturnType<typeof vi.fn>;
|
||||||
runtimeError: ReturnType<typeof vi.fn>;
|
runtimeError: ReturnType<typeof vi.fn>;
|
||||||
}> {
|
}> {
|
||||||
onSpy.mockReset();
|
onSpy.mockClear();
|
||||||
replySpy.mockReset();
|
replySpy.mockClear();
|
||||||
sendChatActionSpy.mockReset();
|
sendChatActionSpy.mockClear();
|
||||||
|
|
||||||
const runtimeError = options.runtimeError ?? vi.fn();
|
const runtimeError = options.runtimeError ?? vi.fn();
|
||||||
const runtimeLog = options.runtimeLog ?? vi.fn();
|
const runtimeLog = options.runtimeLog ?? vi.fn();
|
||||||
@@ -89,7 +89,7 @@ beforeEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
lookupMock.mockReset();
|
lookupMock.mockClear();
|
||||||
resolvePinnedHostnameSpy?.mockRestore();
|
resolvePinnedHostnameSpy?.mockRestore();
|
||||||
resolvePinnedHostnameSpy = null;
|
resolvePinnedHostnameSpy = null;
|
||||||
});
|
});
|
||||||
@@ -525,8 +525,8 @@ describe("telegram text fragments", () => {
|
|||||||
it(
|
it(
|
||||||
"buffers near-limit text and processes sequential parts as one message",
|
"buffers near-limit text and processes sequential parts as one message",
|
||||||
async () => {
|
async () => {
|
||||||
onSpy.mockReset();
|
onSpy.mockClear();
|
||||||
replySpy.mockReset();
|
replySpy.mockClear();
|
||||||
|
|
||||||
createTelegramBot({ token: "tok", testTimings: TELEGRAM_TEST_TIMINGS });
|
createTelegramBot({ token: "tok", testTimings: TELEGRAM_TEST_TIMINGS });
|
||||||
const handler = onSpy.mock.calls.find((call) => call[0] === "message")?.[1] as (
|
const handler = onSpy.mock.calls.find((call) => call[0] === "message")?.[1] as (
|
||||||
|
|||||||
Reference in New Issue
Block a user