diff --git a/src/channels/ack-reactions.test.ts b/src/channels/ack-reactions.test.ts index bd8698ef1a3..cdc10c88265 100644 --- a/src/channels/ack-reactions.test.ts +++ b/src/channels/ack-reactions.test.ts @@ -1,11 +1,14 @@ import { describe, expect, it, vi } from "vitest"; -import { sleep } from "../utils.ts"; import { removeAckReactionAfterReply, shouldAckReaction, shouldAckReactionForWhatsApp, } from "./ack-reactions.js"; +const flushMicrotasks = async () => { + await Promise.resolve(); +}; + describe("shouldAckReaction", () => { it("honors direct and group-all scopes", () => { expect( @@ -238,7 +241,7 @@ describe("removeAckReactionAfterReply", () => { remove, onError, }); - await sleep(0); + await flushMicrotasks(); expect(remove).toHaveBeenCalledTimes(1); expect(onError).not.toHaveBeenCalled(); }); @@ -251,19 +254,7 @@ describe("removeAckReactionAfterReply", () => { ackReactionValue: "👀", remove, }); - await sleep(0); - expect(remove).not.toHaveBeenCalled(); - }); - - it("skips when not configured", async () => { - const remove = vi.fn().mockResolvedValue(undefined); - removeAckReactionAfterReply({ - removeAfterReply: false, - ackReactionPromise: Promise.resolve(true), - ackReactionValue: "👀", - remove, - }); - await sleep(0); + await flushMicrotasks(); expect(remove).not.toHaveBeenCalled(); }); });