feat: make telegram reactions visible to clawdbot
This commit is contained in:
committed by
Peter Steinberger
parent
01c43b0b0c
commit
d05c3d0659
38
src/telegram/sent-message-cache.test.ts
Normal file
38
src/telegram/sent-message-cache.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
clearSentMessageCache,
|
||||
recordSentMessage,
|
||||
wasSentByBot,
|
||||
} from "./sent-message-cache.js";
|
||||
|
||||
describe("sent-message-cache", () => {
|
||||
afterEach(() => {
|
||||
clearSentMessageCache();
|
||||
});
|
||||
|
||||
it("records and retrieves sent messages", () => {
|
||||
recordSentMessage(123, 1);
|
||||
recordSentMessage(123, 2);
|
||||
recordSentMessage(456, 10);
|
||||
|
||||
expect(wasSentByBot(123, 1)).toBe(true);
|
||||
expect(wasSentByBot(123, 2)).toBe(true);
|
||||
expect(wasSentByBot(456, 10)).toBe(true);
|
||||
expect(wasSentByBot(123, 3)).toBe(false);
|
||||
expect(wasSentByBot(789, 1)).toBe(false);
|
||||
});
|
||||
|
||||
it("handles string chat IDs", () => {
|
||||
recordSentMessage("123", 1);
|
||||
expect(wasSentByBot("123", 1)).toBe(true);
|
||||
expect(wasSentByBot(123, 1)).toBe(true);
|
||||
});
|
||||
|
||||
it("clears cache", () => {
|
||||
recordSentMessage(123, 1);
|
||||
expect(wasSentByBot(123, 1)).toBe(true);
|
||||
|
||||
clearSentMessageCache();
|
||||
expect(wasSentByBot(123, 1)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user