mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 18:33:37 +00:00
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
let API_CONSTANTS: typeof import("grammy").API_CONSTANTS;
|
|
let DEFAULT_TELEGRAM_UPDATE_TYPES: typeof import("./allowed-updates.js").DEFAULT_TELEGRAM_UPDATE_TYPES;
|
|
let resolveTelegramAllowedUpdates: typeof import("./allowed-updates.js").resolveTelegramAllowedUpdates;
|
|
|
|
beforeEach(async () => {
|
|
vi.resetModules();
|
|
({ API_CONSTANTS } = await import("grammy"));
|
|
({ DEFAULT_TELEGRAM_UPDATE_TYPES, resolveTelegramAllowedUpdates } =
|
|
await import("./allowed-updates.js"));
|
|
});
|
|
|
|
describe("resolveTelegramAllowedUpdates", () => {
|
|
it("includes the default update types plus reaction and channel post support", () => {
|
|
const updates = resolveTelegramAllowedUpdates();
|
|
|
|
expect(updates).toEqual(
|
|
expect.arrayContaining([
|
|
...DEFAULT_TELEGRAM_UPDATE_TYPES,
|
|
...(API_CONSTANTS?.DEFAULT_UPDATE_TYPES ?? []),
|
|
]),
|
|
);
|
|
expect(updates).toContain("message_reaction");
|
|
expect(updates).toContain("channel_post");
|
|
expect(new Set(updates).size).toBe(updates.length);
|
|
});
|
|
});
|