mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
perf(test): remove timer waits in hooks and discord monitor tests
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { ChannelType, type Guild } from "@buape/carbon";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { sleep } from "../utils.js";
|
||||
import {
|
||||
allowListMatches,
|
||||
buildDiscordMediaPayload,
|
||||
@@ -108,7 +107,7 @@ describe("DiscordMessageListener", () => {
|
||||
{} as unknown as import("./monitor/listeners.js").DiscordMessageEvent,
|
||||
{} as unknown as import("@buape/carbon").Client,
|
||||
);
|
||||
await sleep(0);
|
||||
await Promise.resolve();
|
||||
|
||||
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining("discord handler failed"));
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ describe("hooks", () => {
|
||||
|
||||
it("should handle async handlers", async () => {
|
||||
const handler = vi.fn(async () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
await Promise.resolve();
|
||||
});
|
||||
|
||||
registerInternalHook("command:new", handler);
|
||||
|
||||
Reference in New Issue
Block a user