mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
test: trim redundant ack-reaction removeAfterReply guard case
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user