openclaw/src/telegram/bot-access.test.ts

16 lines
505 B
TypeScript

import { describe, expect, it } from "vitest";
import { normalizeAllowFrom } from "./bot-access.js";
describe("normalizeAllowFrom", () => {
it("accepts sender IDs and keeps negative chat IDs invalid", () => {
const result = normalizeAllowFrom(["-1001234567890", " tg:-100999 ", "745123456", "@someone"]);
expect(result).toEqual({
entries: ["745123456"],
hasWildcard: false,
hasEntries: true,
invalidEntries: ["-1001234567890", "-100999", "@someone"],
});
});
});